micasense / imageprocessing

MicaSense RedEdge and Altum image processing tutorials
https://www.micasense.com
MIT License
263 stars 152 forks source link

not enough values to unpack #192

Open dhkrkh opened 2 years ago

dhkrkh commented 2 years ago

While running the "Testing image reading and panel detection" code from https://micasense.github.io/imageprocessing/MicaSense%20Image%20Processing%20Setup.html

from micasense.image import Image
# imagePath = os.path.join('.','data','0000SET','000')
# imageName = glob.glob(os.path.join(imagePath,'IMG_0000_1.tif'))[0]

img = Image('IMG_0000_1.tif')
img.plot_raw(figsize=(8.73,8.73));

from micasense.panel import Panel
panel = Panel(img)
if not panel.panel_detected():
    raise IOError("Panel Not Detected! Check your installation of pyzbar")
else:
    panel.plot(figsize=(8,8));

print('Success! Now you are ready for Part 1 of the tutorial.')

I am getting the following error,

ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_3148/3671377906.py in <module>
      7 
      8 from micasense.panel import Panel
----> 9 panel = Panel(img)
     10 if not panel.panel_detected():
     11     raise IOError("Panel Not Detected! Check your installation of pyzbar")

~\anaconda3\lib\site-packages\micasense\panel.py in __init__(self, img, panelCorners, ignore_autocalibration)
     43 
     44         self.image = img
---> 45         bias = img.radiance().min()
     46         scale = (img.radiance().max() - bias)
     47         self.gray8b = np.zeros(img.radiance().shape, dtype='uint8')

~\anaconda3\lib\site-packages\micasense\image.py in radiance(self, force_recompute)
    305             a1, a2, a3 = self.radiometric_cal[0], self.radiometric_cal[1], self.radiometric_cal[2]
    306             # apply image correction methods to raw image
--> 307             V, x, y = self.vignette()
    308             R = 1.0 / (1.0 + a2 * y / self.exposure_time - a3 * y)
    309             L = V * R * (image_raw - self.black_level)

~\anaconda3\lib\site-packages\micasense\image.py in vignette(self)
    324         '''
    325         # get vignette center
--> 326         vignette_center_x, vignette_center_y = self.vignette_center
    327 
    328         # get a copy of the vignette polynomial because we want to modify it here

ValueError: not enough values to unpack (expected 2, got 0)

image

I have installed all of the prerequisites libraries and I'm not sure what the issue is with the vignette function. The image used is from Altum-PT

alherca73 commented 1 year ago

Hello @dhkrkh , did you figure this out? any progress on support of these scripts for RedEdge-P or Altum-PT?