Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

region_of_interest issue with fillPoly() #35

Closed
frankcarey opened this issue Mar 17, 2017 · 6 comments
Closed

region_of_interest issue with fillPoly() #35

frankcarey opened this issue Mar 17, 2017 · 6 comments
Assignees

Comments

@frankcarey
Copy link

frankcarey commented Mar 17, 2017

The region_of_interest() function says it takes vertices which it passes to cv2.fillPoly(), but it seems like what that function is supposed to take is an Array of shapes.

I think that function should be updated like so:

-cv2.fillPoly(mask, vertices, ignore_mask_color)
+# We need to pass in an array of shapes (each shape is an array of vertices)
+cv2.fillPoly(mask, [vertices], ignore_mask_color)

Causes error: error: /home/travis/miniconda/conda-bld/conda_1486587071158/work/opencv-3.1.0/modules/imgproc/src/drawing.cpp:2276: error: (-215) p.checkVector(2, CV_32S) >= 0 in function fillPoly

See related error http://stackoverflow.com/questions/17241830/opencv-polylines-function-in-python-throws-exception/18817152#18817152

@scm-ns
Copy link

scm-ns commented Aug 31, 2017

Yep, the second argument is an array of array of points. The cpp interface has a proxy object called InputArrayOfArray.

@YuehChuan
Copy link

this should make a pull request

@BarthesSimpson
Copy link

Actually, it wants a numpy array of (arrays of) 32 bit integers, so it's more like:

cv2.fillPoly(mask, np.array([vertices], dtype=np.int32), ignore_mask_color)

@baumanab
Copy link
Contributor

@mvirgo mvirgo self-assigned this Mar 15, 2018
@mvirgo
Copy link
Contributor

mvirgo commented Mar 15, 2018

The way this is demonstrated in the classroom quiz includes vertices as being an array of shapes already - vertices = np.array([[(0,imshape[0]),(0, 0), (imshape[1], 0), (imshape[1],imshape[0])]], dtype=np.int32) (this is before tuning :) ). I think it may be more confusing to change this within the notebook, as the vertices themselves are already supposed to be in an array.

What are your thoughts? Perhaps just editing the docstring to mention that vertices is an array of integer points might solve it.

mvirgo added a commit that referenced this issue Apr 17, 2018
Updated the docstring for `region_of_interest` to more clearly note what `vertices` should be.

Related to [#35](#35)
mvirgo added a commit that referenced this issue Apr 17, 2018
Updated the docstring for `region_of_interest` to more clearly note what `vertices` should be.

Related to [#35](#35)
@mvirgo
Copy link
Contributor

mvirgo commented Apr 17, 2018

Updated the docstring to clarify this further.

@mvirgo mvirgo closed this as completed Apr 17, 2018
Charingchen pushed a commit to Charingchen/CarND-Find-Lane-Lines that referenced this issue May 5, 2020
Updated the docstring for `region_of_interest` to more clearly note what `vertices` should be.

Related to [#35](udacity/CarND-LaneLines-P1#35)
lmarcell pushed a commit to lmarcell/CarND-LaneLines-P1 that referenced this issue Feb 11, 2021
Updated the docstring for `region_of_interest` to more clearly note what `vertices` should be.

Related to [udacity#35](udacity#35)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants