Removing white background from Barcode image(s)
8 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I'm currently trying to process a large number of barcodes.
I'm using a function available on the forums called generateBarcodeCode39().
it outputs the generated barcode image(s) and saves each respective figure to jpg in a directory.
My Problem:
The size of my barcodes are different. Some times I will have a string of text that is 4-5 characters long, others more.
this results in different image sizes of barcodes that are saved.
i'm trying to have one size inputted into a formatted excel document, which is why the size of the barcodes are important.
Question:
How would I go about removing just the white background that is generated when creating a matlab figure for each image? I've tried imcrop, and it does work for some cases, but it's not a one size fits all solution.
should i just create different inputs to the imcrop() function that specifies each barcode case and crop it accordingly?
3 件のコメント
採用された回答
Rik
2020 年 11 月 20 日
The easiest solution is to not add the border in the first place:
barWidth = 3;barHeight = 100;appendTerminationMarkers = false;i=1;CellData{i,3}=123456;
barcodeArray = generateBarcodeCode39('123456', barWidth, barHeight, appendTerminationMarkers);
if isa(CellData{i,3},'char')
imwrite(barcodeArray,fullfile(pwd,'Barcodes',[ CellData{i,3} '.jpg']));
else
imwrite(barcodeArray,fullfile(pwd,'Barcodes',[num2str(CellData{i,3}) '.jpg']));
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!