Munawwar / codepasta-comments

1 stars 0 forks source link

Simple background removal (Segmentation) | Code Pasta #3

Closed Munawwar closed 1 year ago

Munawwar commented 1 year ago

Written on 01/10/2016 12:13:09

URL: https://www.codepasta.com/site/vision/segmentation/

Munawwar commented 1 year ago

Comment written by alex on 06/07/2016 12:47:48

igdrcl: using XCB-DRI2 authentication...

Traceback (most recent call last):

File "r.py", line 50, in <module>

scharr_8u = np.asarray(scharr, np.uint8)

NameError: name 'scharr' is not defined

Munawwar commented 1 year ago

Comment written by Munawwar on 06/07/2016 14:01:14

Follow Step 1.

Munawwar commented 1 year ago

Comment written by Ramadhan Adityo Kuncoro on 08/29/2016 07:15:43

i get bad result in edge detection, when using your partial source code, can i get full code? thanks

Munawwar commented 1 year ago

Comment written by Munawwar on 08/29/2016 14:02:15

https://gist.github.com/Mun...

The code you see in the gist is not exactly as in this article, but it is slightly better. For example I moved the noise reduction trick to outside the sobel edge function.

I will be writing an updated article soon, since I've learnt ways to improve slightly further that this.

EDIT Nov: I have edited the article to be similar to the link above.

Munawwar commented 1 year ago

Comment written by Retire Monk on 09/09/2017 09:45:24

I tried to run the code from git: https://gist.github.com/Mun...
I am getting this error when I tried to run it:
line 13, in findSignificantContours
image, contours, heirarchy = cv2.findContours(sobel_8u, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
ValueError: need more than 2 values to unpack

Can someone please help

Munawwar commented 1 year ago

Comment written by Munawwar on 09/09/2017 10:05:35

There is a difference between opencv 3 and opencv 2 in return parameters. Check the api reference.

Munawwar commented 1 year ago

Comment written by pranali on 01/10/2018 16:46:25

hey....will u please help me with the code of proper edge detection and background subtraction of video as well as images?? i need perfect output for human body action detection.

Munawwar commented 1 year ago

Comment written by pranali on 01/10/2018 17:18:49

I tried to run above code but i am not getting the output . It is just displaying image name on terminal without any other error.Please help. I am new to opencv.

Munawwar commented 1 year ago

Comment written by Suryadiputra Liawatimena on 05/12/2018 16:56:44

When I change from np.max into np.maximum the error as follow:
Traceback (most recent call last):
File "deteksipinggir-sobel.py", line 77, in <module>
segment('078.jpg')
File "deteksipinggir-sobel.py", line 49, in segment
np.array([edgedetect(blurred[:, :, 0]), edgedetect(blurred[:, :, 1]), edgedetect(blurred[:, :, 2])]), axis=0)
ValueError: invalid number of arguments

When I change from np.max into np.amax the error as follow:
Traceback (most recent call last):
File "deteksipinggir-sobel.py", line 77, in <module>
segment('078.jpg')
File "deteksipinggir-sobel.py", line 49, in segment
np.array([edgedetect(blurred[:, :, 0]), edgedetect(blurred[:, :, 1]), edgedetect(blurred[:, :, 2])]), axis=0)
File "E:\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 2272, in amax
out=out, **kwargs)
File "E:\Anaconda3\lib\site-packages\numpy\core\_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
TypeError: '>=' not supported between instances of 'NoneType' and 'NoneType'

I am using python3, please help, thanks.

Munawwar commented 1 year ago

Comment written by Sergey Galkin on 05/31/2018 07:31:12

You need to add a return statement to the def edgedetect (channel): as follows:

return sobel