How to convert a spectrum/spectra to a barcode

6 vues (au cours des 30 derniers jours)
Curious Mind
Curious Mind le 20 Juin 2018
Réponse apportée : Rajanya le 12 Août 2024
Hello guys,
I have a spectrum (FTIR) and I want to convert the spectrum to a barcode data and possibly plot it. This could be one spectrum or spectra.
Is there any matlab code that I can use to convert my data (Spectrum or spectra) to a barcode data?
see aatahced an example of the data I'm tryting to convert to a barcode. Column 1 is the wavenumber (x-axis) and column 2 is the intensities (y-axis).
Thank you.
  1 commentaire
AbioEngineer
AbioEngineer le 30 Juil 2021
Did you find a solution for this?

Connectez-vous pour commenter.

Réponses (1)

Rajanya
Rajanya le 12 Août 2024
While there is no direct MATLAB functionality which converts sample data into barcode, you can try out a combination ‘repmat()’ and ‘imshow()’ to generate barcodes of your desired lengths and complexities.
By changing the copy number in ‘repmat()’, you can determine the length of your barcode to be generated. Refer to the below example code for better understanding. The binary data is obtained by using a suitable threshold (here, applied on the intensities).
csv = readtable("Convert_To_Barcode.csv")
wavenumbers = csv{:, 1};
intensities = csv{:, 2};
% Normalize the intensities and store the results in normalized_intensities.
threshold = rand; % You can adjust this threshold as needed
binaryData = normalized_intensities > threshold
barcodeWidth = %set a specified value
barcodeImg = repmat(binaryData,barcodeWidth,2)
figure;
imshow(barcodeImg,'InitialMagnification','fit')
The links to the respected documentations are given below:
Hope this helps.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by