필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to compress a location map using JBig compression?

조회 수: 1 (최근 30일)
Aarach Sap
Aarach Sap 2016년 9월 26일
마감: Walter Roberson 2016년 9월 26일
function [y,nbr_bits] = perform_jbig_coding(x)
% perform_jbig_coding - perform binary image coding % % [y,nbr_bits] = perform_jbig_coding(x); % % It requires pbmtojbg and jbgtopbm executable. % % Copyright (c) 2006 Gabriel Peyr
name_pbm = 'b.pbm'; name_jbg = 'c.jbg'; if size(x,1)>1 && size(x,2)>1 % forward transform % save as pbm imwrite(rescale(x), name_pbm, 'pbm'); % convert to jgib !pbmtojbg tmp.pbm tmp.jbg % read jbig file fid = fopen(name_jbg); if fid<0 error('Unable to open Jbig file.'); end [y,cnt] = fread(fid, Inf); fclose(fid); nbr_bits = length(y)*8; % remove tmp files !del tmp.jbg !del tmp.pbm else % backward transform fid = fopen(name_jbg, 'wb'); if fid<0 error('Unable to open Jbig file.'); end fwrite(fid, x); fclose(fid); % convert to pbm !jbgtopbm tmp.jbg tmp.pbm % read pbm y = imread(name_pbm); % remove tmp files !del tmp.jbg !del tmp.pbm nbr_bits = -1; end
Actually, I find this code in matlab. But I don't understand why two ".pbm" and ".jbg" are needed. I have only one location map(.pbm) to compress. As I am very new to programming, it is really hard to understand. Please help me.

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by