2017-01-24 19:08:59 8 Comments
I am currently working in Python to do color detection on a single image. After loading my image and establishing my RGB (or BGR in CV2), I use the following 2 lines to produce a mask and a output image.
mask = cv2.inRange(image, lower, upper)
output = cv2.bitwise_and(image, image, mask = mask)
Then the code displays the following image.
But now, I would like to take the processed image and extract pixel coordinate points for the green line.
Thanks. Any help would be appreciated.
Related Questions
Sponsored Content
10 Answered Questions
[SOLVED] How to detect a Christmas Tree?
- 2013-12-25 12:40:55
- karlphillip
- 21471 View
- 368 Score
- 10 Answer
- Tags: c++ python opencv image-processing computer-vision
23 Answered Questions
[SOLVED] Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition
- 2012-04-16 04:23:16
- Charles Menguy
- 159105 View
- 1485 Score
- 23 Answer
- Tags: c++ algorithm image-processing opencv
0 Answered Questions
I am getting the below error for the following code to detect a particular color
- 2018-05-21 18:04:51
- Shauvik Choudhury
- 53 View
- 1 Score
- 0 Answer
- Tags: python-2.7 opencv image-processing color-detection
2 Answered Questions
[SOLVED] Masking an Image by Manipulating Pixels through Conditions
- 2018-03-28 14:28:49
- Eliyah
- 45 View
- 3 Score
- 2 Answer
- Tags: python opencv pixel color-space
1 Answered Questions
[SOLVED] how to get x,y(coordinate) array of pixels in image
- 2018-03-07 09:20:07
- YYK
- 1001 View
- -1 Score
- 1 Answer
- Tags: python opencv image-processing
0 Answered Questions
BGR to HSV conversion doesn't work with OpenCV Python
- 2018-02-24 18:53:25
- she hates me
- 347 View
- 0 Score
- 0 Answer
- Tags: python opencv image-processing computer-vision opencv3.0
1 Answered Questions
1 Answered Questions
0 Answered Questions
Color detection in opencv (python)
- 2014-11-24 16:06:42
- Nicholas Haesen
- 1017 View
- 1 Score
- 0 Answer
- Tags: python opencv image-processing colors hsv
2 comments
@Soltius 2017-01-26 12:49:14
So, how about findNonZeros() on a binarised version of your image ? Starting with the image with the green line on black background :
EDIT : It has been pointed out on another question that you can also use numpy's function nonzeros. It gives the same results, but I find it to be slower
@Jeru Luke 2017-01-26 10:55:20
My solution is not so neat but you can refine it later.
I drew a line across a black image:
And I have obtained the coordinate values of those pixels in white. I have taken two arrays to store them.
Code:
I know there is a much better way out there. I will update this answer once I figure it out.