OpenCV

Unable to import cv2 and cvbridge in ROS and python3

我与影子孤独终老i 提交于 2021-02-18 18:02:57
问题 Environment Ubuntu 16.04 Python 3.5.2 Ros Distribution-Kinetic Ros was installed as per installation instruction ( sudo apt-get install ros-kinetic-full-desktop ) And to make the Python3 as default version, I followed the necessary and sufficient step of install python3 versions of rospkg and catkin( sudo pip3 install rospkg catkin_pkg ). After which i am able to import cv2 in python2 but not in python3 as below ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined

Unable to import cv2 and cvbridge in ROS and python3

穿精又带淫゛_ 提交于 2021-02-18 18:02:03
问题 Environment Ubuntu 16.04 Python 3.5.2 Ros Distribution-Kinetic Ros was installed as per installation instruction ( sudo apt-get install ros-kinetic-full-desktop ) And to make the Python3 as default version, I followed the necessary and sufficient step of install python3 versions of rospkg and catkin( sudo pip3 install rospkg catkin_pkg ). After which i am able to import cv2 in python2 but not in python3 as below ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined

OpenCV: Understanding warpPerspective / perspective transform

二次信任 提交于 2021-02-18 17:13:52
问题 I made a small example for myself to play around with OpenCVs wrapPerspective, but the output is not completely as I expected. My input is a bar at an 45° angle. I want to transform it so that it's vertically aligned / at an 90° angle. No problem with that. However, what I don't understand is that everything around the actual destination points is black. The reason I don't understand this is, that actually only the transformation matrix gets passed to the wrapPerspective function, not the

Detect number of rows and columns in table image with OpenCV

天涯浪子 提交于 2021-02-18 17:12:40
问题 How can we get the number of rows and columns in an Image table via Opencv. Code for getting boxes in table which I am getting right contours, hierarchy = cv2.findContours(img_final_bin, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) def sort_contours(cnts, method="left-to-right"): # initialize the reverse flag and sort index reverse = False i = 0 # handle if we need to sort in reverse if method == "right-to-left" or method == "bottom-to-top": reverse = True # handle if we are sorting against the y

Detect number of rows and columns in table image with OpenCV

社会主义新天地 提交于 2021-02-18 17:07:13
问题 How can we get the number of rows and columns in an Image table via Opencv. Code for getting boxes in table which I am getting right contours, hierarchy = cv2.findContours(img_final_bin, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) def sort_contours(cnts, method="left-to-right"): # initialize the reverse flag and sort index reverse = False i = 0 # handle if we need to sort in reverse if method == "right-to-left" or method == "bottom-to-top": reverse = True # handle if we are sorting against the y

Change color of a pixel with OpenCV

故事扮演 提交于 2021-02-18 15:48:24
问题 Let say I have this rose (Do not care about the background, only the white leaves are important). I transform it to a grayscale picture: grayscaled=cv2.imread('white_rose.png',cv2.IMREAD_GRAYSCALE) How can I change every white pixel to a red one under the condition the red color ( R=255 ) will have the same contrast as the white one has ? Meaning I want to see the white leaves in red color but with the same L value of every pixel that in grayscaled ? 回答1: You need to loop over your grey image

Change color of a pixel with OpenCV

你说的曾经没有我的故事 提交于 2021-02-18 15:47:25
问题 Let say I have this rose (Do not care about the background, only the white leaves are important). I transform it to a grayscale picture: grayscaled=cv2.imread('white_rose.png',cv2.IMREAD_GRAYSCALE) How can I change every white pixel to a red one under the condition the red color ( R=255 ) will have the same contrast as the white one has ? Meaning I want to see the white leaves in red color but with the same L value of every pixel that in grayscaled ? 回答1: You need to loop over your grey image

Opencv Python open dng format

梦想的初衷 提交于 2021-02-18 12:31:02
问题 I can't figure out how to open a dng file in opencv. The file was created when using the pro options of the Samsung Galaxy S7. The images that are created when using those options are a dng file as well as a jpg of size 3024 x 4032 (I believe that is the dimensions of the dng file as well). I tried using the answer from here (except with 3 colors instead of grayscale) like so: import numpy as np fd = open("image.dng", 'rb') rows = 4032 cols = 3024 colors = 3 f = np.fromfile(fd, dtype=np.uint8

Getting error in cv::imshow() - ASSERT: “false” in file qasciikey.cpp, line 501

岁酱吖の 提交于 2021-02-18 11:29:30
问题 I am getting this error whenever I call cv::waitKey(): ASSERT: "false" in file qasciikey.cpp, line 501 I am not sure why I am getting this error. I am running on an Ubuntu Server 14.04 EC2 instance connected through MobaXterm on Windows. If I run all of the same code on a normal ubuntu machine, all works great. This is the line where this happens: char key = cvWaitKey(33); 回答1: A workaround in MobaXterm is to uncheck "Unix-compatible keyboard" in X11 settings. 回答2: Try this. pip install

How to come from C# stream to OpenCV Mat by using c++/cli?

北慕城南 提交于 2021-02-18 08:36:42
问题 I am reading some image from Azure Blob storage. This is a stream in c#. In c++/cli I need to do this: cv::Mat img_object = imdecode(data, IMREAD_UNCHANGED); where data is of type cv::InputArray so the question is how do I best get from c# to the cv::mat? public ref class Client { public: // TODO: Add your methods for this class here. void Method(Stream ^ img1, Stream ^ img2); }; void Client::Method(...){ } I just put in Stream ^ img1, Stream ^img2, thats not a requirement, just not sure what