I have already change images into grayscale under windows system by using python ,however when it turned into linux i found it need more code to guide the computer . I may can get the code to achieve but i don’t know how to write the cmake projects. So I beg someone can provide me a executable example on linux for me to learn more.
I tried to turn a image into grayscale with the same code but i don’t know how to achieve it on linux by using cmake to compile them into machine language and the way to execute it.
import cv2 as cv
import sys
img = cv.imread("starry_night.jpg")
if img is None:
sys.exit("Could not read the image.")
cv.imshow("Display window", img)
k = cv.waitKey(0)
if k == ord("s"):
cv.imwrite("starry_night.png", img)
k = cv.waitKey(0)