Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Load and show image
- image = rgb2gray(imread('DfPMAaE.jpg'));
- imshow(image)
- % Select and show region of interest
- BW = roipoly;
- close
- imROI = image.*uint8(BW);
- imshow(imROI)
- % Set a pixel intensity threshold (because we're lazy)
- thresh = 90;
- % Find contour of curve
- for indCol = 3:size(imROI,2)
- if size(find(imROI(:,indCol)>thresh,1,'first'),1) == 1
- x(indCol) = find(imROI(:,indCol)>thresh,1,'first');
- else x(indCol) = NaN;
- end
- end
- hold on, plot(x,'Color','w','LineWidth',2)
- y = naninterp(x(10:end));
- % Normalize waveform
- y = y - mean(y);
- y = (y - min(abs(y)))./(max(abs(y))-min(abs(y)));
- plot(y,'Color','k','LineWidth',2)
- % Create sweet beautiful music
- sound(y,8000)
- filename = 'rain.wav';
- audiowrite(filename,y,Fs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement