END
This commit is contained in:
parent
154a832b2a
commit
588c73969d
15
V2rgb.m
15
V2rgb.m
|
|
@ -13,6 +13,12 @@
|
||||||
|
|
||||||
|
|
||||||
% Loop through the images selected
|
% Loop through the images selected
|
||||||
|
|
||||||
|
% Initialize a matrix to store RGB values
|
||||||
|
all_rgb = zeros(900, 3, 61, 101);
|
||||||
|
|
||||||
|
% Initialize iteration
|
||||||
|
a=0;
|
||||||
for i = 100:1000
|
for i = 100:1000
|
||||||
% Set the image path
|
% Set the image path
|
||||||
image_path = imread(sprintf('frame2_%d.jpg', i));
|
image_path = imread(sprintf('frame2_%d.jpg', i));
|
||||||
|
|
@ -23,12 +29,6 @@ for i = 100:1000
|
||||||
imwrite(roi, (sprintf('frames/my_imagev2%d.jpg',i)));
|
imwrite(roi, (sprintf('frames/my_imagev2%d.jpg',i)));
|
||||||
end
|
end
|
||||||
|
|
||||||
% Initialize a matrix to store RGB values
|
|
||||||
all_rgb = zeros(900, 3, 61, 101);
|
|
||||||
|
|
||||||
% Initialize iteration
|
|
||||||
a=0;
|
|
||||||
|
|
||||||
% Loop through 900 images
|
% Loop through 900 images
|
||||||
for i = 100:1000
|
for i = 100:1000
|
||||||
% Read image
|
% Read image
|
||||||
|
|
@ -51,6 +51,7 @@ for i = 100:1000
|
||||||
% Display iteration
|
% Display iteration
|
||||||
disp(a);
|
disp(a);
|
||||||
end
|
end
|
||||||
|
|
||||||
% Compute mean RGB values for each image
|
% Compute mean RGB values for each image
|
||||||
mean_rgb = squeeze(mean(mean(all_rgb, 4), 3));
|
mean_rgb = squeeze(mean(mean(all_rgb, 4), 3));
|
||||||
save('mean_rgb.m', 'mean_rgb');
|
save('mean_rgb.m', 'mean_rgb');
|
||||||
|
|
@ -115,7 +116,7 @@ hold off;
|
||||||
|
|
||||||
xlabel('Frequency (Hz)');
|
xlabel('Frequency (Hz)');
|
||||||
ylabel('Magnitude');
|
ylabel('Magnitude');
|
||||||
legend('Red', 'Green', 'Blue');
|
legend({'Red', 'Green', 'Blue'});
|
||||||
|
|
||||||
% Find indices in f that correspond to the frequency range of interest
|
% Find indices in f that correspond to the frequency range of interest
|
||||||
idx_range = find(f >= 0.75 & f <= 4);
|
idx_range = find(f >= 0.75 & f <= 4);
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,7 @@ total_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||||
frame_number = 0
|
frame_number = 0
|
||||||
while True:
|
while True:
|
||||||
success, frame = video.read()
|
success, frame = video.read()
|
||||||
if not success:
|
cv2.imwrite("frame2_{}.jpg".format(frame_number), frame)
|
||||||
break
|
|
||||||
if frame_number % int(frame_rate / 24) == 0:
|
|
||||||
cv2.imwrite("frame2_{}.jpg".format(frame_number), frame)
|
|
||||||
frame_number += 1
|
frame_number += 1
|
||||||
|
|
||||||
# Release the video file
|
# Release the video file
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue