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

ColorFilter block gives OpenCV error #211

Open
toshan-luktuke opened this issue Feb 5, 2023 · 5 comments
Open

ColorFilter block gives OpenCV error #211

toshan-luktuke opened this issue Feb 5, 2023 · 5 comments

Comments

@toshan-luktuke
Copy link
Collaborator

Running a simple example of ColorFilter gives the following error:

Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/toshan/Downloads/Untitled/modules/ColorFilter2001.py", line 19, in main
    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
cv2.error: OpenCV(4.7.0) /io/opencv/modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<3>; VDepth = cv::impl::{anonymous}::Set<0, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = cv::impl::<unnamed>::NONE; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'
> Invalid number of channels in input image:
>     'VScn::contains(scn)'
> where
>     'scn' is 1

OpenCV version: 4.7.0
OS: Ubuntu 20.04
Circuit Image:
image

@siddheshsingh26
Copy link
Contributor

siddheshsingh26 commented Feb 16, 2023

Hey, I was working on this issue and I suspect it may be a system-specific problem since I didn't encounter the error as you did.

This is my system configuration:

  • OpenCV version: 4.2.0
  • OS : Pop_os 20.04

Circuit Image:

Screenshot from 2023-02-16 23-29-49

Output

Screenshot from 2023-02-17 01-03-27

Here are the steps I followed:

  • First, I created the circuit by using three blocks: the camera and screen block from Drivers->OpenCV, and the color filter from Processing->OpenCV.
  • Next, I compiled the main.py file after building the circuit.
  • The output displayed the Frame with the blue color filtered out.

@toshan-luktuke
Copy link
Collaborator Author

Hmm, its definitely possible... Let me re-check once

@toshan-luktuke
Copy link
Collaborator Author

So looking into it further, this issue seems to occur when due to simultaneous execution of blocks, the Colour Filter block tries to execute without an image being supplied to it. In this case the if frame == None is not enough and we need to add a new way to check for existence/non-existence of the image object

@toshan-luktuke
Copy link
Collaborator Author

Currently the check:
if frame.shape == () seems to be working fine. However I don't know if this is the best way to check. So this'll need some investigation

@siddheshsingh26
Copy link
Contributor

Yes, I'll try to find another way to this issue if possible.

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

2 participants