[Solved] how to find the black region in near the edge

color_img = imread(‘0k4Kh.jpg’); img = rgb2gray(color_img); [x, y] = size(img); for i = 1:x if length(find(img(i, :))) ~= 0 lastmarginalrow = i-1; break; end end for ii = y:-1:1 if length(find(img(:, ii))) ~= 0 lastmarginalcol = ii-1; break; end end figure; fig = imshow(color_img); h = impoly(gca, [0,x; lastmarginalcol,x; lastmarginalcol,lastmarginalrow; 0,lastmarginalrow]); api = iptgetapi(h); api.setColor(‘red’); … Read more

[Solved] How can I make my program input images taken from a Camera? [closed]

You can capture a single frame by using the VideoCapture method of OpenCV. import cv2 pic = cv2.VideoCapture(0) # video capture source camera (Here webcam of laptop) ret,frame = pic.read() # return a single frame in variable `frame` while(True): cv2.imshow(‘img1’,frame) #display the captured image if cv2.waitKey(1) & 0xFF == ord(‘y’): #save on pressing ‘y’ cv2.imwrite(‘images/c1.png’,frame) … Read more

[Solved] The best color to track using opencv

The best way to track object is to transform the video you get from RGB to HSV //convert frame from BGR to HSV colorspace cvtColor(cameraFeed,HSV,COLOR_BGR2HSV); and than use erode() and dilate() function to avoid disorders. Than using a certain range of HUE values you can select a range of colors. There isn’t a best color, … Read more

[Solved] CMake still not working with OpenCV [duplicate]

Have you tried actually setting the environment variables (CMAKE_MODULE_PATH and/or OpenCV_DIR) the error message tells you to set? You can do that from Control Panel > System > Advanced System Settings > Environment Variables See if they exist (and point to the correct path), otherwise just create them… 8 solved CMake still not working with … Read more