transformation

Comparing images using SIFT

孤人 提交于 2019-12-01 14:44:34
I'm trying to compare 2 images that are taken from a digital camera. Since there may be movement on the camera, I want to first make the pictures "match" and then compare (using some distant function). To match them, I'm thinking about cropping the second picture and using SIFT to find it inside the first picture... it will probably have a small difference on scale/translation/rotation so then I'd need to find the transformation matrix that converts image 1 to image 2 (based on points found by SIFT) any ideas on how to do that (or I guess that's a common problem that may have some opensource

Are these functions column-major or row-major?

*爱你&永不变心* 提交于 2019-12-01 11:55:24
I'm comparing two different linear math libraries for 3D graphics using matrices. Here are two similar Translate functions from the two libraries: static Matrix4<T> Translate(T x, T y, T z) { Matrix4 m; m.x.x = 1; m.x.y = 0; m.x.z = 0; m.x.w = 0; m.y.x = 0; m.y.y = 1; m.y.z = 0; m.y.w = 0; m.z.x = 0; m.z.y = 0; m.z.z = 1; m.z.w = 0; m.w.x = x; m.w.y = y; m.w.z = z; m.w.w = 1; return m; } (c++ library from SO user prideout) static inline void mat4x4_translate(mat4x4 T, float x, float y, float z) { mat4x4_identity(T); T[3][0] = x; T[3][1] = y; T[3][2] = z; } (linmath c library from SO user

Are these functions column-major or row-major?

戏子无情 提交于 2019-12-01 11:13:48
问题 I'm comparing two different linear math libraries for 3D graphics using matrices. Here are two similar Translate functions from the two libraries: static Matrix4<T> Translate(T x, T y, T z) { Matrix4 m; m.x.x = 1; m.x.y = 0; m.x.z = 0; m.x.w = 0; m.y.x = 0; m.y.y = 1; m.y.z = 0; m.y.w = 0; m.z.x = 0; m.z.y = 0; m.z.z = 1; m.z.w = 0; m.w.x = x; m.w.y = y; m.w.z = z; m.w.w = 1; return m; } (c++ library from SO user prideout) static inline void mat4x4_translate(mat4x4 T, float x, float y, float

HTML5 Canvas putImageData, translate it, change Image

耗尽温柔 提交于 2019-12-01 10:41:33
I want to draw an image using a HTML5 canvas, translate the image and then change the image but keep the transformations I've made. Is this possible? Here's some pseudo-code to illustrate my problem: // initially draw an image and translate it var context = canvas.getContext("2d"); context.putImageData(someData, 0, 0); context.translate(200, 10); // then later somewhere else in code // this should be drawn @ 200/10 var context = canvas.getContext("2d"); context.putImageData(someOtherData, ?, ?); I thought this would be possible by some save/restore calls but I did not succeed yet, so how can I

how many pixels is a meter in Box2D?

早过忘川 提交于 2019-12-01 10:34:06
Question is simple so, no codes! If someone knows Box2D and SDL2, then, please tell me how to wrap SDL_Rect with b2body. Ofcourse, it requires to know the conversion of metre to pixel and vice versa. This is because Box2D measures distance in metres. Can you give me a simple expression or function to convert metres(of Box2D) to pixels or pixels to metres(of Box2D)? Can you give me a simple expression or function to convert metres(of Box2D) to pixels or pixels to metres(of Box2D)? Unfortunately, this isn't as simple as it sounds, for us. Because, if your game is on worms, then your game world

Prepare data for MultilayerPerceptronClassifier in scala

安稳与你 提交于 2019-12-01 09:09:16
Please keep in mind I'm new to scala. This is the example I am trying to follow: https://spark.apache.org/docs/1.5.1/ml-ann.html It uses this dataset: https://github.com/apache/spark/blob/master/data/mllib/sample_multiclass_classification_data.txt I have prepared my .csv using the code below to get a data frame for classification in Scala. //imports for ML import org.apache.spark.ml.classification.MultilayerPerceptronClassifier import org.apache.spark.ml.evaluation.MulticlassClassificationEvaluator import org.apache.spark.mllib.util.MLUtils import org.apache.spark.sql.Row //imports for

HTML5 Canvas putImageData, translate it, change Image

北城余情 提交于 2019-12-01 08:38:54
问题 I want to draw an image using a HTML5 canvas, translate the image and then change the image but keep the transformations I've made. Is this possible? Here's some pseudo-code to illustrate my problem: // initially draw an image and translate it var context = canvas.getContext("2d"); context.putImageData(someData, 0, 0); context.translate(200, 10); // then later somewhere else in code // this should be drawn @ 200/10 var context = canvas.getContext("2d"); context.putImageData(someOtherData, ?,

How can I transform rows into repeated column based data?

。_饼干妹妹 提交于 2019-12-01 08:27:29
问题 I'm trying to take a dataset that looks like this: And transform the records into this format: The resulting format would have two columns, one for the old column names and one column for the values. If there are 10,000 rows then there should be 10,000 groups of data in the new format. I'm open to all different methods, excel formulas, sql (mysql), or straight ruby code would work for me also. What is the best way to tackle this problem? 回答1: Just for fun: # Input file format is tab separated

C- Indexing x,y,z coordinates in a 1D byte array

谁说我不能喝 提交于 2019-12-01 06:51:52
问题 I want to evaluate the values of the surface to implement a marching tetrahedron algorithm, but I don't understand how to work with .raw unformatted data. After loading a .raw file with a volume dataset into a 1D byte array, what arithmetic transformation should be applied to get the value associated to X,Y,Z from it? This is the only way I know to load .raw files, could I create a 3D byte array instead of this? How? int XDIM=256, YDIM=256, ZDIM=256; const int size = XDIM*YDIM*ZDIM; bool

How can I calculate a multi-axis SCNVector4 rotation for a SCNNode?

自闭症网瘾萝莉.ら 提交于 2019-12-01 06:47:21
问题 The SCNNode take a rotation using a SCNVector4 , which has an angle (w) and a magnitude how that angle applies to each axis (x, y, z). For example, to rotate 45 degrees around the x-axis I'd create a SCNVector4 like this: SCNVector4Make(1.0f, 0, 0, DEG2RAD(45)) What I'd like to do is rotate it across all three axis, for example: 45 degrees on the x-axis, 15 degrees on the y-axis and -135 degress across the z-axis. Does anyone know the math to calculate the final SCNVector4 ? 回答1: You'll need