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

add hyperspectral crop to crop or as new function #1312

Closed
maliagehan opened this issue Jul 25, 2023 · 1 comment
Closed

add hyperspectral crop to crop or as new function #1312

maliagehan opened this issue Jul 25, 2023 · 1 comment
Assignees
Labels
new feature New feature ideas and solutions

Comments

@maliagehan
Copy link
Member

Is your feature request related to a problem? Please describe.
need to add to crop so that hyperspectral data can be cropped (make function out of tedious rebuilding of hyperspectral data)

Describe the solution you'd like
code modified from jorge:

h,w,z=np.shape(spectral_array.pseudo_rgb)

white_crop = pcv.crop(white_img.array_data, 0, 0, h, w)
dark_crop= pcv.crop(dark_img.array_data, 0, 0, h, w)

dims1 = white_crop.shape
dims2 = dark_crop.shape

white_crop_filename = "./white_reference_crop.hdr"
dark_crop_filename = "./dark_reference_crop.hdr"

white_spec = pcv.Spectral_data(array_data=white_crop, min_wavelength=white_img.min_wavelength,
max_wavelength=white_img.max_wavelength, min_value=np.min(white_crop),
max_value=np.max(white_crop), d_type=white_crop.dtype,
wavelength_dict=white_img.wavelength_dict, samples=int(dims1[2]), lines=int(dims1[0]),
interleave='BIL', wavelength_units=white_img.wavelength_units,
array_type="datacube", pseudo_rgb=white_crop, default_bands=white_img.default_bands,
filename='.')
pcv.hyperspectral.write_data(white_crop_filename, white_spec)

dark_spec = pcv.Spectral_data(array_data=dark_crop, min_wavelength=dark_img.min_wavelength,
max_wavelength=dark_img.max_wavelength, min_value=np.min(dark_crop),
max_value=np.max(dark_crop), d_type=dark_crop.dtype,
wavelength_dict=dark_img.wavelength_dict, samples=int(dims2[2]), lines=int(dims2[0]),
interleave='BIL', wavelength_units=dark_img.wavelength_units,
array_type="datacube", pseudo_rgb=dark_crop, default_bands=dark_img.default_bands,
filename='.')
pcv.hyperspectral.write_data(dark_crop_filename, dark_spec)

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context, sample data, or code relevant to the feature request here.

@maliagehan maliagehan added the new feature New feature ideas and solutions label Jul 25, 2023
@maliagehan maliagehan self-assigned this Aug 4, 2023
@maliagehan maliagehan mentioned this issue Aug 7, 2023
8 tasks
@HaleySchuhl
Copy link
Contributor

Closed with #1323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature ideas and solutions
Projects
None yet
Development

No branches or pull requests

2 participants