OpenCV

Writing video with openCV - no key frame set for track 0

左心房为你撑大大i 提交于 2021-02-20 16:46:47
问题 I'm trying to modify and write some video using openCV 2.4.6.1 using the following code: cv::VideoCapture capture( video_filename ); // Check if the capture object successfully initialized if ( !capture.isOpened() ) { printf( "Failed to load video, exiting.\n" ); return -1; } cv::Mat frame, cropped_img; cv::Rect ROI( OFFSET_X, OFFSET_Y, WIDTH, HEIGHT ); int fourcc = static_cast<int>(capture.get(CV_CAP_PROP_FOURCC)); double fps = 30; cv::Size frame_size( RADIUS, (int) 2*PI*RADIUS ); video

Changing colours of an area in an image using opencv in python

北城余情 提交于 2021-02-20 09:19:46
问题 I have a picture were I want to change all white-ish pixels to grey, but only for a certain area of the image. Example picture, I just want to change the picture outside of the red rectangle, without changing the image within the red rectangle: I already have the general code, which was part of someone elses Stackoverflow question, that changes the colour of every white pixel instead of only just the one outside of an area. image = cv.imread("meme 2.jpg") hsv = cv.cvtColor(image, cv.COLOR

Changing colours of an area in an image using opencv in python

天大地大妈咪最大 提交于 2021-02-20 09:19:41
问题 I have a picture were I want to change all white-ish pixels to grey, but only for a certain area of the image. Example picture, I just want to change the picture outside of the red rectangle, without changing the image within the red rectangle: I already have the general code, which was part of someone elses Stackoverflow question, that changes the colour of every white pixel instead of only just the one outside of an area. image = cv.imread("meme 2.jpg") hsv = cv.cvtColor(image, cv.COLOR

Displaying image without waitKey

放肆的年华 提交于 2021-02-20 06:50:30
问题 This Python code displayed an image in full screen: blank_image = cv2.imread('blank.jpg') cv2.namedWindow("bw", cv2.WND_PROP_FULLSCREEN) cv2.setWindowProperty("bw", cv2.WND_PROP_FULLSCREEN, cv2.cv.CV_WINDOW_FULLSCREEN) cv2.imshow("bw", blank_image) cv2.waitKey(0) The problem is the code is going to run on a Linux machine without keyboard. Calling waitKey means the UI processing will not be done until a key event occurs, and thus the contradiction. Is there any way beside the waitKey, then?

Displaying image without waitKey

一世执手 提交于 2021-02-20 06:50:29
问题 This Python code displayed an image in full screen: blank_image = cv2.imread('blank.jpg') cv2.namedWindow("bw", cv2.WND_PROP_FULLSCREEN) cv2.setWindowProperty("bw", cv2.WND_PROP_FULLSCREEN, cv2.cv.CV_WINDOW_FULLSCREEN) cv2.imshow("bw", blank_image) cv2.waitKey(0) The problem is the code is going to run on a Linux machine without keyboard. Calling waitKey means the UI processing will not be done until a key event occurs, and thus the contradiction. Is there any way beside the waitKey, then?

How to fill contours that touch the image border?

本秂侑毒 提交于 2021-02-20 06:35:29
问题 Say I have the following binary image created from the output of cv::watershed() : Now I want to find and fill the contours, so I can separate the corresponding objects from the background in the original image (that was segmented by the watershed function). To segment the image and find the contours I use the code below: cv::Mat bgr = cv::imread("test.png"); // Some function that provides the rough outline for the segmented regions. cv::Mat markers = find_markers(bgr); cv::watershed(bgr,

How to fill contours that touch the image border?

馋奶兔 提交于 2021-02-20 06:34:12
问题 Say I have the following binary image created from the output of cv::watershed() : Now I want to find and fill the contours, so I can separate the corresponding objects from the background in the original image (that was segmented by the watershed function). To segment the image and find the contours I use the code below: cv::Mat bgr = cv::imread("test.png"); // Some function that provides the rough outline for the segmented regions. cv::Mat markers = find_markers(bgr); cv::watershed(bgr,

How to read jpeg image with Adobe RGB colorspace in OpenCV?

对着背影说爱祢 提交于 2021-02-20 06:28:33
问题 I am trying to read and write jpegs wth Adobe RGB colorspace in OpenCV. OpenCV assumes the jpeg has sRGB colorspace and when displaying or writing to file, the image loses some of its color intensity. I found this intensity loss was due to colorspace difference by answers given to my previous question. Is there anyway I can make OpenCV to read Adobe RGB colorspace without casting it to sRGB? 回答1: Some information that is hopefully useful for anyone looking for a work-around for dealing with

How to read jpeg image with Adobe RGB colorspace in OpenCV?

筅森魡賤 提交于 2021-02-20 06:26:35
问题 I am trying to read and write jpegs wth Adobe RGB colorspace in OpenCV. OpenCV assumes the jpeg has sRGB colorspace and when displaying or writing to file, the image loses some of its color intensity. I found this intensity loss was due to colorspace difference by answers given to my previous question. Is there anyway I can make OpenCV to read Adobe RGB colorspace without casting it to sRGB? 回答1: Some information that is hopefully useful for anyone looking for a work-around for dealing with

How to read jpeg image with Adobe RGB colorspace in OpenCV?

半世苍凉 提交于 2021-02-20 06:22:56
问题 I am trying to read and write jpegs wth Adobe RGB colorspace in OpenCV. OpenCV assumes the jpeg has sRGB colorspace and when displaying or writing to file, the image loses some of its color intensity. I found this intensity loss was due to colorspace difference by answers given to my previous question. Is there anyway I can make OpenCV to read Adobe RGB colorspace without casting it to sRGB? 回答1: Some information that is hopefully useful for anyone looking for a work-around for dealing with