2017-11-28 06:00:40 -0500 received badge ● Famous Question (source) 2017-06-27 09:38:00 -0500 received badge ● Notable Question (source) 2017-04-10 09:07:29 -0500 received badge ● Popular Question (source) 2016-01-07 11:41:27 -0500 received badge ● Student (source) 2015-12-19 05:43:05 -0500 commented question copy vector of mat to vector of mat @pklab:Ok, thanks. 2015-12-19 04:56:38 -0500 commented answer print comparison matrix elements @pklab:You meant int instead of 1 above?So,even if I declare test as double type ,it will be uchar type. 2015-12-19 04:39:26 -0500 commented answer copy small part of mat to another @pklab:Ok,thanks for the help! 2015-12-19 04:37:30 -0500 commented question print comparison matrix elements @berak: Hmm, so even though I am declaring test matrix to be double , the comparison results in uchar.But the type of test matrix remains double?Thanks! ( make that an answer please) 2015-12-19 04:17:03 -0500 asked a question print comparison matrix elements I want to know why trying to access (and print) test matrix results in showing garbage: Mat A = (Mat_(3,3) << 0, -1.4, 0.2, -1, 5.4, -1, 0.1, -1.4, 0); cout << "A = " << endl << " " << A << endl << endl; Mat B = (Mat_(3,3) << 0, -1.4, 0.4, -2, 5.4, -11, 0, -1.42, 0); cout << "B = " << endl << " " << B << endl << endl; Mat test = Mat(3,3,CV_64F); test = ( A == B ); for ( int i = 0; i < 3; i++ ) { for (int j = 0; j < 2; j++ ) { cout << test.at(i,j) << endl; } }  If I use just cout << test it is ok ,but I want to know why the previous doesn't work. Thanks! 2015-12-18 16:24:36 -0500 asked a question copy vector of mat to vector of mat (This is related to this ) I have a vector src which is filled with data. It's size is src.resize( N ) I have another vector dest; I am declaring it's size to be dest.resize( N ) 1) What is the right way to copy src to dest?Just dest=src? 2) If I want to copy to dest ,only the 1st row and all columns of src vector, then what size the dest vector should be? dest = src; src( Range(0, 1),Range::all() ).copyTo( dest(Range::all(), Range::all() ) ); //for the 1st array of vector  If ,for example src is 4x4 , then ,since I want to keep only 1st row and all columns,the dest size should be 1x4. Is there a way to do this ?Using the src( Range(0, 1),Range::all() ).copyTo( dest(Range::all(), Range::all() ) )? Or,another idea , is to have the dest the same size with src ,but fill all the rest elements with zero for example? =====UPDATE================ I figured this:  dest = src[0 ]( Range(0, 1),Range::all() );  for first row and all columns. ( I can't make it an answer yet ,but if there is another way please share ) 2015-12-18 14:55:28 -0500 commented answer copy small part of mat to another The truth is that I have vector src and vector dst;Both , with .resize(N).I tried copy dst= src;but it gives me floating point exception. ( src is a filled vector and dst empty).Thanks! 2015-12-18 14:39:15 -0500 commented answer copy small part of mat to another Thanks for the help.I am trying the last methid you described but I am receiving assertion failed...m.dims >= 2 in function Mat. My src mat has the same size as dst.But , keep in mind that I want to copy(keep) only a row and all columns from src to the dest.So, what about the size of dest?Just be the same as src? 2015-12-18 13:13:21 -0500 asked a question copy small part of mat to another I can't figure how to copy a part of mat to another mat. ( or to itself) I want for example to copy (or to keep) only the first row of srcMat. I am using :  for ( int x = 0; x < height; x++ ) { for ( int y = 0; y < width; y++ ) { destMat = scrMat.at(0,y); // or destMat.at(x,y) = scrMat.at(0,y); } }  I am not sure about using:  srcMat.copyTo( destMat( Rect( y, 0, srcMat.cols, srcMat.rows ) ) );  2015-12-17 07:33:32 -0500 commented answer countnonzero seg fault @thdrksdfthmn:Yes,that is ok, thanks! 2015-12-17 07:30:51 -0500 received badge ● Scholar (source) 2015-12-17 07:30:47 -0500 commented question countnonzero seg fault @LorennaGdL:Ok, thanks!( I was a little confused) 2015-12-17 06:06:42 -0500 commented question countnonzero seg fault @LorenaGdL:But , I am setting the mycompare , access it in the countNonZero function ,then at the 2nd loop , set the mycompare , access it and so on. ( I am just asking for the if statement ) 2015-12-17 05:57:05 -0500 commented question countnonzero seg fault @LorenaGdL:If I just do mycompare[ index++ ] = ( A[ idx ] == A[ k ] ); myCounts[ index ] = countNonZero( mycompare[ index ] ); , should't work also ? ( because it doesn't) 2015-12-17 05:50:52 -0500 commented question countnonzero seg fault @LorenaGdL:Yes!You are right,I missed that!Is there a way to use if statement for this? ( please make it an answer if you want)Thanks! 2015-12-17 05:35:05 -0500 asked a question countnonzero seg fault Hello , I want to use countNonZero , but I am getting a seg fault at the countNnZero line. vector mycompare; int compareSize = (N / 2) * (N -1); mycompare.resize( compareSize ); int myCounts [ compareSize ]; int index = 0; for ( int idx = 0; idx < N; idx++ ) { for ( int k = idx + 1; k < N; k ++ ) { mycompare[ index++ ] = ( A[ idx ] == A[ k ] ); myCounts[ index++ ] = countNonZero( mycompare[ index ] ); } }  OR Is there a way to use if statement?: if ( mycompare[ index ] == 255 ) count++;  2015-12-14 08:41:32 -0500 commented question access image after cutting @LorenaGdL:Ok.So , mat objects do element by element operations.Ok.Thanks.If you want make it an answer. 2015-12-14 07:51:58 -0500 commented question access image after cutting @LorenaGdL:But still I am going to access .at( coordinates) ,right?Can you give an example? 2015-12-14 07:08:34 -0500 commented question access image after cutting @LorenaGdL:I just want to know why this happens. You said : f you're gonna use a per-pixel loop later, avoid it....And then ,what should I use? 2015-12-14 06:51:58 -0500 commented question access image after cutting @LorenaGdL:That's right.But , why can I access at( 300,239999 ) ??I would expect until at( 199,199).Thanks 2015-12-14 06:30:58 -0500 commented question access image after cutting @LorenaGdL:Hello ,I updated.I am scanning in the loop the whole image (600x600) and I am creating 9 pieces of 200x200. ( 800/200 = 3) 2015-12-14 05:47:52 -0500 commented question access image after cutting @sturkmen:Thank's but I am trying to understand what is wrong with my code. 2015-12-14 05:26:52 -0500 asked a question access image after cutting I have a 600x600 image ( Image) and i am cutting into pieces of 200x200 (piecesImages),by creating 3x3 blocks (Height = 3 , Width =3). Mat pieceImageFrame (200,200,CV_32F); vector piecesImagesRois; vector piecesImages; piecesImagesRois.reserve( Width * Height ); piecesImages.reserve( Width * Height ); for( int i = 0; i ( 199,199)  but as I can see I am able to access: piecesImages[ 0 ].at( 300,239999 ) !!  I would expect a grabage value but the values seem ok! 2015-12-10 05:44:24 -0500 received badge ● Enthusiast 2015-12-05 12:57:12 -0500 received badge ● Supporter (source) 2015-12-05 09:41:53 -0500 commented question read image as array - save array as image @pklab:Thanks for the help.So,the proper way to use pointers in order to access data is (after checking the continuous ) is to use const float* ptr1 = grayImage.ptr(i);in the loop ?And what about accessing the data outside the loop? ( because ptr1 is defined in the loop according to [this] http://docs.opencv.org/3.0.0/d3/d63/c... 2015-12-05 08:14:06 -0500 received badge ● Editor (source) 2015-12-05 08:10:47 -0500 asked a question read image as array - save array as image Hello , I just started to study openCV and I am trying to figure how to properly read the image as array. First of all , when I am loading the image using imread , what is the type ? Always unsigned char? So,for example, I am trying to do: ... Mat grayImage; ... unsigned char *myData = grayImage.data; int width = grayImage.cols; int height = grayImage.rows; for(int i = 0; i < height; i++) { for(int j = 0; j < width; j++) { cout << "Mat[ " << i * width + j << " ] = " << (myData[ i * width + j ]) << "\t"; } cout << endl; }  I am receiving as output symbols and letters. Also, if I want to store an array as an image what steps must I follow? (I forgot to mention that I want to use pointers in order to access data)