question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in finding contour (find object) for Hyperspectral Image

See original GitHub issue

Description In the pcv.find_objects function. I am constantly getting the same error, even after trying with multiple images. There is a big chance that the error is from my side. But I’ve tried multiple options in my capability. I would like to ask if anyone can solve this for me.

To Reproduce

  • Installed PlantCV using Anaconda
  • Python 3.7.12
  • Conda 4.10.3

The function I am using: id_objects, obj_hierarchy = pcv.find_objects(img=index_array_gdvi.array_data, mask=gdvi_thresh)

Error:

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
C:\Users\PCADMI~1\AppData\Local\Temp/ipykernel_19112/1019017205.py in <module>
      4    #   img  - RGB or grayscale image data for plotting
      5    #   mask - Binary mask used for detecting contours
----> 6 id_objects, obj_hierarchy = pcv.find_objects(img=index_array_gdvi.array_data, mask=gdvi_thresh)

f:\billy_graham_ram\plantcv\plantcv\plantcv\find_objects.py in find_objects(img, mask)
     32     if len(np.shape(ori_img)) == 2:
     33         ori_img = cv2.cvtColor(ori_img, cv2.COLOR_GRAY2BGR)
---> 34     objects, hierarchy = cv2.findContours(mask1, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)[-2:]
     35     # Cast tuple objects as a list
     36     objects = list(objects)

**error: OpenCV(3.4.16) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\contours.cpp:197: error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl'**

Local environment: OS: Windows 10 Pro Environment: conda PlantCV Version: 3.13.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nfahlgrencommented, Dec 1, 2021

Great! We don’t have anything specifically planned at the moment but that is a great idea. We will be doing a workshop at the upcoming NAPPN annual meeting (https://www.plantphenotyping.org/) but I’m not sure what the topic(s) will be yet. We have enjoyed doing virtual workshops through Phenome Force (https://phenome-force.github.io/PhenomeForce/) and I could imagine doing more of those or something similar in the new year.

0reactions
billygrahamramcommented, Dec 1, 2021

@nfahlgren Thank you for your time! It did work. One more request: are there any upcoming workshops on HSI analysis using PlantCV? Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I'm trying to detect the contours on a red object in an image but ...
I'm trying to get the contours of a portion of an image but I keep getting an error when I call the cv.findContour...
Read more >
Getting Started with ENVI - L3HarrisGeospatial.com
The ENVI Feature Extraction module can be used to identify objects from panchromatic or multispectral imagery based on spatial, spectral, and texture ...
Read more >
Contour and Texture Analysis for Image Segmentation
Abstract. This paper provides an algorithm for partitioning grayscale images into disjoint regions of coherent brightness and texture.
Read more >
Using Contours to Detect and Localize Junctions in Natural ...
We present a new, high-performance detector for con- tours in natural images, and use its output to detect and lo- calize image junctions....
Read more >
Contour Detection for UAV-Based Cadastral Mapping - MDPI
Contour detection, especially in computer vision, refers to finding boundaries between objects or segments. Early approaches, such as Canny edge detection [15], ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found