# Accessing pixel and coordinate of an image using OpenCV

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.

"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]

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

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

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

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.