필터 지우기
필터 지우기

Create binary image from compressed domain values in text file

조회 수: 4 (최근 30일)
Yousra Ashfaq
Yousra Ashfaq 2022년 10월 27일
편집: Yousra Ashfaq 2022년 11월 21일
These are the .txt and .csv files of one of the frame. I want to be able to create a binary image from this file, I have the index of the block, the width, height, x position, y position and total number of bits. I wnat to use total no.of bits as pixel intensity and create an image based on that. Convert that no.of bits column to 0s and 1s either by didving by the largest value or taking the logarithmic value and create the image. Please guide me on how I should proceed further :)
clear all;
clc
cutable = readtable ('frame1.csv'); % i,x,y,w,h,no.of bits
carray = table2array (cutable);
len = length (carray);
idx = carray (:,1);
w = carray (:,2);
h = carray (:,3);
x = carray (:,4);
y = carray (:,5);
b = carray (:,6);

답변 (1개)

Walter Roberson
Walter Roberson 2022년 11월 18일
cutable = readtable ('frame1.csv'); % i,x,y,w,h,no.of bits
carray = table2array (cutable);
len = length (carray);
idx = carray (:,1);
w = carray (:,2);
h = carray (:,3);
x = carray (:,4) + 1;
y = carray (:,5) + 1;
b = carray (:,6);
maxx = max(x + w - 1);
maxy = max(y + h - 1);
img = zeros(maxy, maxx);
for K = 1 : numel(x)
tx = x(K); ty = y(K);
img(ty:ty+h(K)-1, tx:tx+w(K)-1) = b(K);
end
img8 = uint8(rescale(img, 0, 255));
subplot(2,1,1);
image(img8)
colormap(gray(256))
title('linear');
minb = min(b);
scaleb = log(b ./ minb);
img = zeros(maxy, maxx);
for K = 1 : numel(x)
tx = x(K); ty = y(K);
img(ty:ty+h(K)-1, tx:tx+w(K)-1) = scaleb(K);
end
subplot(2,1,2);
imgL = uint8(rescale(img, 0, 255));
image(imgL)
colormap(gray(256))
title('log')
It looks to me as if the x, y indexing is not correct
You indicate that the first column is the index, but you have multiple entries with the same index, such as
64,32,32,32,0,449
64,16,16,32,0,139
It looks to me as if the first four columns have to do with position and size. However you have entries such as
0,64,64,0,0,2316
and if we try to interpret those as x y w h or w h x y then we seem to encounter either x or h that are 0, which does not sound correct.
  댓글 수: 3
Image Analyst
Image Analyst 2022년 11월 21일
편집: Image Analyst 2022년 11월 21일
You aren't trying to track individual jockeys or horses with images like that are you? Because that would be nearly impossible. But start here:
Yousra Ashfaq
Yousra Ashfaq 2022년 11월 21일
편집: Yousra Ashfaq 2022년 11월 21일
@Image Analyst I am working in video compressed domain. I am experimenting on both hevc and vvc. I have extracted features from their reference softwares and using those features I am trying to detect either background/foreground or moving objects. The number of bits extracted are high when there's movement and low when there's not much movement, thats why we were able to create an image using x, y coordinates and number of bits :)
If you have any suggestion on how to proceed with my problem, let me know :)

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by