Ask Your Question
0

Accessing pixel and coordinate of an image using OpenCV

asked 2013-06-01 22:24:13 -0600

hayden gravatar image

Hello everybody,an image is defined by a number of pixels in row and column direction. Is the center of the image is always (0,0) is OpenCV? Suppose for an image of size 256X256, what is the difference between each pixel in row and column direction. How can I find the difference of a particular pixel from the center of the image? I need to clarify these basic things. Thanks in advance.

edit retag flag offensive close merge delete

Comments

"Is the center of the image is always (0,0) ?"

no, [0,0] is top-left. center would be [127,127] or [rows/h,cols/h]

berak gravatar imageberak ( 2013-06-02 03:53:47 -0600 )edit

Actually I was asking about the center coordinate, isn't is (0,0)?

hayden gravatar imagehayden ( 2013-06-02 11:50:28 -0600 )edit

the coords are indices into the row/col arrays. it's a matrix. so, - no.

again, center is (rows/2, cols/2).

berak gravatar imageberak ( 2013-06-02 12:16:36 -0600 )edit

Thanks for the clarification. That means point coordinates of pixels follows (i,j) of Matrix. Actually i was just displaying the image pixel in C language where I centred the image at (0,0) and with point coordinates ranging from (-127, -127) to (127, 127). I think I need to convert the center to (0,0) to get the correct result.

hayden gravatar imagehayden ( 2013-06-03 09:55:18 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-06-02 02:38:19 -0600

Jawaher Khemakhem gravatar image

Have a look here and here

edit flag offensive delete link more

Comments

Thank you very much, those links are very helpful.

hayden gravatar imagehayden ( 2013-06-02 11:48:32 -0600 )edit

@hayden Hey can you tell me how to find any extreme points of contour like car contour. I already use background subtraction, findcontour , drawcontour in my code . now i want find any point from this contour and using contour i want to find distance between extreme points on contour and minimum point on contour because my object is moving in real time.

coco gravatar imagecoco ( 2014-10-16 01:52:18 -0600 )edit

Question Tools

Stats

Asked: 2013-06-01 22:24:13 -0600

Seen: 17,014 times

Last updated: Jun 02 '13