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

Trouble accessing the intensity value of a CV_U8 gray image in C++

$
0
0
In a larger context, I'd like to perform a sweep on detected circle object in a image, but cannot get a reasonable intensity value or I guess access the pixel correctly. I expect a uchar pixel type with values from 0-255. When I run the code, I get outputs that either involve letters or numbers that are much too low to be correct. I use cvtColor() to first change a RGB image to Gray. The RGB image is originally a CV_8UC3 type mat image. I am also using openCV 3.0. Here's a small snippet of code where I try to display a pixel value in the terminal. Here, circles is a vector of vectors, and I'm using it to access the center point of the detected circle object. When I draw the detected circles on the image and display it, there seems to be no issue. Point2f center(cvRound(circles[0][0]), cvRound(circles[0][1])); int x = round(circles[0][0]); int y = round(circles[0][1]); printf("center: %x\n", image.at(center)); printf("center: %x\n", image.at(circles[0][0], circles[0][1])); printf("center: %x\n", *image.ptr(x, y)); Thanks! Rowan

Viewing all articles
Browse latest Browse all 19555

Trending Articles



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