Skip to content
New issue

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

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

Already on GitHub? # to your account

Issue with detecting a particular sign #11

Open
animeshkalita82 opened this issue Dec 4, 2020 · 3 comments
Open

Issue with detecting a particular sign #11

animeshkalita82 opened this issue Dec 4, 2020 · 3 comments

Comments

@animeshkalita82
Copy link

Hi
I have run the main.py file with the sample video and encountered the an error. The program could correctly predict the first two signs(one way, speed limit 30) of the video but when it tries to predict the third sign(right turn) it fails and throws the below error.

File "main.py", line 316, in main
roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV)
cv2.error: OpenCV(3.4.8) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

I have noticed that the roi value for that third image has become empty roi=[]

roi = frame[tl[1]:br[1], tl[0]:br[0]]
print('roi=======', roi) // here it is empty
roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV)

Please help to resolve this issue.

@hoanglehaithanh
Copy link
Owner

Hi @animeshkalita82,

You can add an if condition before the cvtColor function to make sure roi is not empty

@animeshkalita82
Copy link
Author

Hi @animeshkalita82,

You can add an if condition before the cvtColor function to make sure roi is not empty

Hi
Thank you very much for reply.
If I put a condition to check the roi value if it is null or not then it skips the right turn sign and I need to show it. So i made a change in the below code

old code : roi = frame[tl[1]:br[1], tl[0]:br[0]]
new code: roi = frame[tl[1]:br[1], tl[1]:br[1]]

Now I can see that the model correctly identifies the right turn sign. So can you tell me if this change is ok?

@hoanglehaithanh
Copy link
Owner

Hi @animeshkalita82,

Sorry but I haven't had any activities on this repo for years, so it is hard for me to check whether it works or not.

Anw, if your correction makes the code works, take it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants