Can anyone please explain image pixel coordinate plane?

I am trying to understand the image pixel coordinate system which is a bit different than the point coordinate system. Sox as far as I know the y increases from top to bottom while x increases from left to right as every image starts from (0,0) origin to the very topleft most corner and bottomright most corner(1019,664) vary based on the image Please find the attached image below

As you can see the topleft corner has coordinates (x:517, y:321) while bottomright corner has coordinates (x:1018, y:302). So not sure why y coordinate of bottomright corner is less than y coordinate of topleft? Here is the code

if(event == cv2.EVENT_LBUTTONDOWN):
			cv2.circle(dst, (x,y), 3, (0,255,255), 4, cv2.LINE_AA)
			cv2.putText(dst, "x: {x},y:{y}".format(x=x,y=y), (x-250,y), cv2.FONT_HERSHEY_SIMPLEX, 1,(0,100,255),2,cv2.LINE_AA)
			cv2.imshow("Destination Image", dst)

The reason I am doing x-250 is just for display purpose. The image coordinate system is the most fundamental concept in Image processing and OpenCV. Can anyone please explain me this concept?

that’s all correct.

please show more code, there must be a silly mistake in it

Here is the full code. so what this code does is it will open an imagewindow and when we left click anywhere in the image it will show the point where we leftclicked and its coordinate. I hope this helps

import cv2
import numpy as np

counter = 0
points = []
def MouseCallback(event, x, y, flags, userdata):
    global counter
    if(event == cv2.EVENT_LBUTTONDOWN):
        if(counter < 4):
            cv2.circle(dst, (x,y), 3, (0,255,255), 4, cv2.LINE_AA)
            cv2.putText(dst, "x: {x},y:{y}".format(x=x,y=y), (x-250,y), cv2.FONT_HERSHEY_SIMPLEX, 1,(0,100,255),2,cv2.LINE_AA)
            cv2.imshow("Destination Image", dst)
            points.append((x,y))
            counter += 1
            #print(x,y)
            #print(points)
        if(len(points) == 4):
            #roi = dst[:,541:1018]
            #cv2.imshow("winname", roi)
            #print(points)
            array_points = np.array(points)
            #new_points = order_points(array_points)
            print(array_points)
            cv2.imwrite("saved.jpg", dst)
            #top_left_x = min(points, key=itemgetter(1))[0]
            #top_left_y = min(points, key=itemgetter(0))[0]
            #bot_right_x = max(points, key=itemgetter(1))[0]
            #bot_right_y = max(points, key=itemgetter(0))[0]
            
            #height = top_left_y - bot_right_y
            #width = top_left_x - bot_right_x
            #print(y1,x1,y2,x2)
            #roi = dst[top_left_y:bot_right_y+1,top_left_x:bot_right_x+1]
            #cv2.imshow("roi", roi)
dst = cv2.imread("times_square.jpg")
mask = np.zeros((dst.shape[:2]),dtype='uint8')
cv2.imshow("mask", mask)
cv2.imshow("Destination Image", dst)
print(cv2.EVENT_RBUTTONDOWN,"hello")
cv2.setMouseCallback("Destination Image", MouseCallback)
key = cv2.waitKey(0)
if( key == ord('q') ):
    cv2.destroyAllWindows()

the bottom right point is higher than the top left one. that means its Y coordinate must be smaller.

why did you assert otherwise? you should question your perception more often.