Red, Green, Blue Full image pattern file's RGB value distortion when patterns was saved to jpg file form.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
JUNHYEONG KIM
il 15 Feb 2023
Commentato: JUNHYEONG KIM
il 20 Feb 2023
Hello,
I met the problem that is RGB full image pattern file's RGB value distortion at jpg file.
I want to make the specific color box pattern that have background and center box. and this file must be jpg file.
but when I run this code to make perfect red pattern(255, 0, 0) and verify this is right color,
the red pattern file had RGB value of (254, 0, 0) .
Could you tell me how to generate perfect red(255,0,0 / jpg file)?
also I try to imwirte(img, filename, 'Quality', 100), however this problem was not cleared.
and equally if I make perfect green and blue, this green have (0, 255, 1) / blue have (0, 0, 254).
Please, Note below the function code:
function value = fullimage(image_values, V, H)
for i = 1: size(image_values, 1)
% CSV 파일 내 데이터를 한 줄씩 가져오는 작업
image_values_row = image_values(i,1:7); %수정 Point2
% CSV 파일 내 한 줄의 데이터 내에서 각 필요한 데이터를 하나씩 추출
R = image_values_row(1); %R value of RGB
G = image_values_row(2); %G value of RGB
B = image_values_row(3); %B value of RGB
BS = image_values_row(4);
BGR = image_values_row(5); %Back ground R value of RGB
BGG = image_values_row(6); %Back ground G value of RGB
BGB = image_values_row(7); %Back ground B value of RGB
% CSV 파일 내 색상 RGB 값을 통해 BackGround에 RGB값 지정
img(1:V, 1:H, 1) = BGR/255;
img(1:V, 1:H, 2) = BGG/255;
img(1:V, 1:H, 3) = BGB/255;
% Box size에 따라 내부에 Box가 생성되도록 하는 수식, 양의 정수 범위어야함.
Vbox1 = round(V/2-sqrt(BS)/20*V)+1;
Vbox2 = round(V/2+sqrt(BS)/20*V)+1;
Hbox1 = round(H/2-sqrt(BS)/20*H)+1;
Hbox2 = round(H/2+sqrt(BS)/20*H)+1;
% CSV 파일 내 색상 RGB 값을 통해 Box에 RGB값 지정
img(Vbox1:Vbox2, Hbox1:Hbox2, 1) = R/255;
img(Vbox1:Vbox2, Hbox1:Hbox2, 2) = G/255;
img(Vbox1:Vbox2, Hbox1:Hbox2, 3) = B/255;
%이미지 저장
filename = sprintf('image%d.jpg',i);
imwrite(img,filename);
end
end
2 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 영상의 산술 연산 in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!