georgslazdans / outline-app

Outline recognition app
https://outline.georgs.lv
GNU Affero General Public License v3.0
117 stars 10 forks source link

Error on loading image #7

Closed gehoida closed 1 month ago

gehoida commented 1 month ago

Hi, when I try to process the attached image, I get the following error:

Failed to execute step: grayScaleObject, Exception: OpenCV(4.9.0) /build/4_x-contrib_docs-lin64/opencv/modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::(anonymous namespace)::CvtHelper<cv::impl::(anonymous namespace)::Set<3, 4, -1>, cv::impl::(anonymous namespace)::Set<1, -1, -1>, cv::impl::(anonymous namespace)::Set<0, 2, 5>, cv::impl::(anonymous namespace)::NONE>::CvtHelper(cv::InputArray, cv::OutputArray, int) [VScn = cv::impl::(anonymous namespace)::Set<3, 4, -1>, VDcn = cv::impl::(anonymous namespace)::Set<1, -1, -1>, VDepth = cv::impl::(anonymous namespace)::Set<0, 2, 5>, sizePolicy = cv::impl::(anonymous namespace)::NONE]' > Invalid number of channels in input image: > 'VScn::contains(scn)' > where > 'scn' is 1 Background Image Settings Untitled

georgslazdans commented 1 month ago

Hi! At the moment the error handling is almost non existent and the error message should be "Paper contours not found!". I am working on it to implement that.

As for the image, the background has similar values to paper in gray scale and causes paper outline to have holes in the threshold step. The easiest fix would be to have background that is of different color around the paper and provides good contrast. Outlined_grayscale small_threshold

To solve this with software would require a bit more knowledge of image processing than I currently have or to do some kind of line reconstruction for the contours it can find. Both of which would take a fairly long time to implement.

georgslazdans commented 1 month ago

Did some refactoring and added a visible error message when the paper outline is not found. Screenshot from 2024-09-15 13-06-45