Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

write pixel to mat

$
0
0
I want to manually set every pixel's R,G, and B floating point values to 0.4. When I run the following code I get an error. What am I doing wrong? The error at run-time is: > *** Error in `./program': free(): invalid next size (fast):> 0x00000000019f9080 *** Aborted #include "opencv2/highgui/highgui.hpp" #include using namespace std; using namespace cv; int main() { Mat imageF(36,36, CV_32F); int i = 0; int j = 0; float blue = 0.0; float green= 0.0; float red= 0.0; Vec3f intensity; for(j=0; j(j, i); //blue = intensity.val[0]; //green = intensity.val[1]; //red = intensity.val[2]; blue = red = green = 0.4; intensity.val[0] = blue; intensity.val[1] = green; intensity.val[2] = red; imageF.at(j, i) = intensity; } } imshow("Output", imageF); waitKey(0); return 0; }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>