Comments (6)
It's hard to know what's going on without seeing the failing code. Is it possible that you haven't implemented the radiometric corrections that are implemented in cell #2 of the alignment tutorial prior to running align_capture
?
If you have questions about the radiometric corrections, please refer to the earlier tutorials where they are described in detail. It would be a good start to ensure you can run the Alignment notebook on the provided data. Then substitute your own data, and try to determine what might be different.
https://github.com/micasense/imageprocessing/blob/master/Alignment.ipynb
In the future an issue report should always contains at minimum the following elements:
- Title/Description
- Environment (including all code that is failing)
- Steps to reproduce
- Expected Result(s)
- Actual Result(s)
from imageprocessing.
It may not be obvious from the alignment tutorial, but the library lazy-computes reflectance images within a Capture
object only when they are needed. In the tutorial, the
capture.plot_undistorted_reflectance(panel_irradiance)
method ensures this computation is done. If plotting is not necessary, instead call
capture.compute_reflectance(panel_irradiance)
where panel_irradiance
is computed using panel image radiance and the provided panel reflectance values (which are different for every panel) by calling
capture.panel_irradiance(panel_reflectance)
and panel_reflectance
is a list of panel reflectance values in the range 0-1 for each band, in RedEdge band_index order (not wavelength order).
from imageprocessing.
Firstly, the problem is how to calibrate raw images from the camera into reflectance maps
As (1) described, from raw images to radiance worked as following:
import micasense.utils as msutils
radianceImage, L, V, R = msutils.raw_image_to_radiance(meta, imageRaw)
convert radiance to reflectance worked as following:
Select panel region from radiance image , some codes are omitted
meanRadiance = panelRegion.mean()
panelReflectance = panelCalibration[bandName]
radianceToReflectance = panelReflectance / meanRadiance
reflectanceImage = radianceImage * radianceToReflectance
(2).https://github.com/micasense/imageprocessing/blob/master/Alignment.ipynb
As (2) described,from raw images to reflectance worked as following:
panel_irradiance = panelCap.panel_irradiance(panel_reflectance_by_band)
capture.plot_undistorted_reflectance(panel_irradiance)
from raw images to radiance, in 'panel_irradiance()',
irradiance_list = []
for i,p in enumerate(self.panels):
mean_irr = p.irradiance_mean(reflectances[i])
irradiance_list.append(mean_irr)
where
def irradiance_mean(self, reflectance):
radiance_mean, _, _, _ = self.radiance()
return radiance_mean * math.pi / reflectance
convert radiance to reflectance worked as following,in 'plot_undistorted_reflectance',
self.reflectance(irradiance_list)
and in (2), 'self.radiance()' equal to 'msutils.raw_image_to_radiance()' in (1), reflectances[i] in (2) equal to 'panelCalibration[bandName]' in (1), self.panels in (2) equal to panelRegion in (1) .
In (1), transform coefficient from radiance to reflectance is radianceToReflectance , in (2), transform coefficient is irradiance_list, is 'mean_irr' in (2) equal to 'meanRadiance' in (1)?
I haven't seen something like 'panelRegion.mean()', how could 'radiance_mean' in (2) represent the mean of radiance image?
from imageprocessing.
Secondly, you are right ! I comment out the following line and errors behind appear.
capture.plot_undistorted_reflectance(panel_irradiance)
just after add 'compute_reflectance', code go through.
capture.compute_reflectance(panel_irradiance)
but in this step
warp_matrices, alignment_pairs = imageutils.align_capture(capture, max_iterations=100)
error appeared as following
Alinging images. Depending on settings this can take from a few seconds to many minutes
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib64/python3.6/multiprocessing/spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "/usr/lib64/python3.6/multiprocessing/spawn.py", line 114, in _main
prepare(preparation_data)
File "/usr/lib64/python3.6/multiprocessing/spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "/usr/lib64/python3.6/multiprocessing/spawn.py", line 277, in _fixup_main_from_path
run_name="mp_main")
File "/usr/lib64/python3.6/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pengyaoyao/project/uav_registration/imageprocessing/test.py", line 34, in
warp_matrices, alignment_pairs = imageutils.align_capture(capture, max_iterations=10)
File "./micasense/imageutils.py", line 117, in align_capture
multiprocessing.set_start_method('spawn')
File "/usr/lib64/python3.6/multiprocessing/context.py", line 242, in set_start_method
raise RuntimeError('context has already been set')
RuntimeError: context has already been set
Environment
python3.6
from imageprocessing.
I think your first question is answered in https://github.com/micasense/imageprocessing/blob/master/micasense/panel.py#L144
where self
here is a Panel
object, so it has a defined region if a panel is found in the image or if the corners are provided at initialization.
def radiance(self):
radiance_img = self.image.undistorted(self.image.radiance())
return self.region_stats(radiance_img,self.panel_corners())
Your second issue is likely that you're re-running the alignment code in the same notebook without re-starting the kernel. multiprocessing.set_start_method('spawn')
can only be called once in a program.
The solution is probably to "restart and run all" in your notebook. This is a terrible feature of jupyter notebooks; they save state and tend to hide it from the developer. Many times notebook problems can be fixed with "restart and run all."
from imageprocessing.
first question is OK
second issue is solved, too.
When using spawn I should guard the part that launches the job in
if __name__ == '__main__':
.set_start_method should also go there, and everything run fine.
from imageprocessing.
Related Issues (20)
- not compatible with Altum-PT? HOT 3
- Bug encountered with panel_albedo reporting different reflectance values HOT 2
- after running batch processing the images resulted are not aligned well HOT 1
- Many codes are uncompatible with RedEdge-p HOT 2
- Stuck at Solving Environment on Anaconda HOT 4
- Imageutils.map_points still uses deprecated np.float instead of np.float32 HOT 2
- Will there be support for the newer sensors RedEdge-P and Altum-PT? HOT 2
- Ask for the calculating of reflectance
- ValueError: Provided file path does not have a band name HOT 2
- Output stacks of "Batch Processing-10Band.ipynb" is not the reflectance
- Ask for updating the software version HOT 1
- Backward compatibility problem with the non-panchromatic cameras after applying the panchromatic camera support HOT 1
- Troubleshooting the output from the calibrations (sun sensor, radiometric) HOT 1
- Converting .ipynb to .py issue: display() HOT 2
- AttributeError: module 'exiftool' has no attribute 'ExifToolHelper' HOT 1
- error to access the micasense library from the anaconda environment HOT 1
- Error invalid requirement
- ERROR: Error [WinError 2] El sistema no puede encontrar el archivo especificado while executing command git version ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
- ERROR: Error [WinError 2] The system cannot find the specified file.
- Issues with Jupyter Notebook while following the tutorial
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imageprocessing.