Ask Your Question
0

Weird result from MorphologyEx

asked 2018-09-14 14:09:13 -0500

Papercut gravatar image

updated 2018-09-14 18:14:27 -0500

Hi guys,

I am trying to use MorphologyEx to open the white area in ful horizontal way. Please see the image attached. But in the result, the white is not fully opened horizontally.

kernel = np.ones((50,2),np.uint8) cv.morphologyEx(img, cv.MORPH_CLOSE, kernel) //MORPH_OPEN also doesn't give me what I want

image description

What is wrong in my code?

image description

The above code is not my exact code tho. I am using OpenCVSharp now.

My OpenCVSharp code is: Cv.MorphologyEx( image, image, temp, new IplConvKernel( 50, 2, 1, 1, ElementShape.Ellipse ), MorphologyOperation.Close );

Please help!

edit retag flag offensive close merge delete

Comments

Can you post a sample image, that's not working. Particularly as a .png, so we can see the exact same pixel values.

Tetragramm gravatar imageTetragramm ( 2018-09-14 17:51:56 -0500 )edit

I uploaded a sample image and the actual code I used. Please help!

Papercut gravatar imagePapercut ( 2018-09-14 18:14:56 -0500 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2018-09-14 21:33:35 -0500

Tetragramm gravatar image

Ok, I think I see the problem.

First, (but not the problem) we don't know anything about OpenCVSharp, and it's entirely possible for them to mess things up. So really, you're lucky it's obvious.

Second, anything that is lpl is very old and out of date and you should not use it. Look for something called getSttructuringElement and replace the lplConvKernel with that.

Then check all the rest of your code and get rid of any lpl stuff.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-09-14 14:09:13 -0500

Seen: 35 times

Last updated: Sep 14