How do I extract data from a specific point I click on a hyperspectral image?
31 次查看(过去 30 天)
显示 更早的评论
I have a hypercube created with the hypercube() function and was able to display the hyperspectral image using colorize(). I am now wondering how I can click on a specific point on the image and extract the hyperspectral data. I tried using [x, y] = ginput(1), but that only gives me the x and y coordinates on the image itself, not the data associated what those coordinated.
Any help would be appreciated.
Thanks, and let me know if more information is needed.
0 个评论
回答(2 个)
Abhishek Tripathi
2024-11-6,4:16
Hi Keegan,
There is one way to extract data from a specific point in your hyperspectral data: by using our Hyperspectral Viewer app. This app allows you to interactively explore and analyze your hyperspectral dataset. With it, you can view individual bands as grayscale images or create color composite representations like RGB, color-infrared (CIR), and false-color images. You can also visualize various hyperspectral indices directly in the app.
For point-specific data extraction, simply click on a location of interest in the image. The app generates a "spectral profile" for that point, displaying its spectral signature across all bands. This is a powerful way to identify materials or elements within the hyperspectral data. Additionally, you can plot and export spectral profiles for small regions, giving insight into the spectral characteristics of selected areas.
For more detailed instructions, please refer to our guide on exploring hyperspectral data in the Hyperspectral Viewer app.
0 个评论
Sameer
2024-11-4,17:58
Hi @Keegan
To extract hyperspectral data from a specific point after selecting it with "ginput", follow these steps:
1. Use "ginput(1)" to get the x and y coordinates of the point you clicked.
2. Convert the coordinates to indices that correspond to your data array. This typically involves rounding the values.
3. Extract the data from the hypercube using these indices.
Here's a sample code snippet
% Assuming 'hcube' is your hypercube object
colorize(hcube);
% Get a point from the user
[x, y] = ginput(1);
% Convert to integer indices
xIndex = round(x);
yIndex = round(y);
% Extract the hyperspectral data for the selected point
spectralData = squeeze(hcube.DataCube(yIndex, xIndex, :));
% Plot the spectral data
figure;
plot(spectralData);
xlabel('Band Number');
ylabel('Reflectance');
title('Spectral Signature at Selected Point');
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hyperspectral Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!