Ask Your Question
0

What is cv2.inRange used for? What is its syntax suppose to be?

asked 2017-11-21 06:52:05 -0600

Santhosh1 gravatar image

updated 2017-11-21 06:54:01 -0600

I'm trying to replicate the Magic Wand tool of the Photo Shop

I want to sent a tolerance to my selected ROI in an image, as mentioned in this post.

I found this link, thought it might be useful.

I came across this cv2.inRange but this is the Documentation, I found on inRange.

I have no clue as to what kind of values have to be actually passed into inRange.

If you have any better idea of how to replicate Magic Wand, do share. I posted my idea here

edit retag flag offensive close merge delete

Comments

1

please do NOT try to abuse a computer-vision library to reproduce photoshop.

berak gravatar imageberak ( 2017-11-21 07:05:01 -0600 )edit
1

@berak I am, do and always will respect to the Field of Computer Vision. I need its property which has been around for a decade. I don't know how to code it in OpenCV

Santhosh1 gravatar imageSanthosh1 ( 2017-11-21 07:14:54 -0600 )edit

yea, i'm just saying ..

berak gravatar imageberak ( 2017-11-21 07:24:11 -0600 )edit

3 answers

Sort by ยป oldest newest most voted
0

answered 2017-11-22 04:59:14 -0600

updated 2017-11-22 04:59:41 -0600

Replicating magic wand, is by implementing a technique called GrabCut. You need to define a color range of pixels on which you will force your wand, but the general idea can be found in this paper:

http://citeseerx.ist.psu.edu/viewdoc/...

edit flag offensive delete link more
0

answered 2017-11-22 08:53:33 -0600

kbarni gravatar image

The magic wand tool in Photoshop uses the active contours (or snakes) algorithm to follow the outline of an object. It was present in old OpenCV implementations, but it was removed as it wasn't very accurate. You can find the source code here, you can reuse it in your project.

Anyway, probably the GrabCut will give better results - even if technically it isn't the same algorithm.

edit flag offensive delete link more
0

answered 2017-11-21 19:42:46 -0600

Tetragramm gravatar image

Fortunately for you, we have a tutorial: Thresholding Operations using inRange.

That explains what it does.

There is also the tutorial for python: HERE

That shows how to call it in python.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-11-21 06:52:05 -0600

Seen: 812 times

Last updated: Nov 22 '17