MATLAB PROGRAMMING CHALLENGE
I'm looking to make a program to super-impose a rectangle over a selected part of an image. First, I need to use "uigetfile" to allow the user to select an image. Then show the image, and allow the user to select 2 points, to form a rectangle. Keep the image data in one variable, and make a copy to another. In the copy, put a red rectangle according to the selected points. Then copy in the original over the red rectangle, with a little offset from the selected points. Then show this version to the user. This way, the user will see the image with the outline of a red rectangle according to the selected points.
Thanks
Please find required MATLAB code along with necessary details in comments:
clear all; close all; clc;
% load an image
[file,path] = uigetfile('*.jpg');
if isequal(file,0)
disp('User selected Cancel');
else
disp(['User selected ', fullfile(path,file)]);
end
img=rgb2gray(imread(fullfile(path,file)));
[m,n]=size(img); % determine its size
imshow(img)
[x,y] = ginput(2);
% genearte window location
start_row=min(x); end_row=max(x);
start_col=min(y); end_col=max(y);
close all
figure;
copy_img=img;
imshow(copy_img); %show your image
hold on;
rectangle('Position', [start_row start_col end_row-start_row
end_col-start_col] ,...
'EdgeColor', 'r',...
'LineWidth', 3,...
'LineStyle','-'); % draw rectangle on image
======================== SCREENSHOT OF CODE
![main_script.m + clear all: close all clc: % load an image [file, path] = uigetfile(*.jpg); if isequal (file, o) disp (User selected Cancel) else disp(IUser selected , fullfile (path, file) ]): end 10 img=rgb2gray (imread (fullfile (path, file) ) ) ; [m, ni-size (img); determine its size imshow (img) [x, y] ginput (2) ; 12 13 - 14 15 16 17 18 19 % genearte window location start_row-min (x): end row-max (x); start col=min (y) ; end COI=max(y) ; close all figure: copy img img: imshow (copyimg); %show your image hold on; rectangle Position [start row start col end row-start row end col-start col],.. . 21 23 - 25 26 27 28 29 EdgeColor, r, . . . LineWidth, 3, LineStyle,-); % draw rectangle on image](http://img.homeworklib.com/questions/65168520-425f-11ec-a415-957417e543b3.png?x-oss-process=image/resize,w_560)
================================= SAMPLE INPUT

======================================== SAMPLE OUTPUT

MATLAB PROGRAMMING CHALLENGE I'm looking to make a program to super-impose a rectangle over a selected...
C++ Programming Objects
Problem Assignment: Programming challenge #1 on page 714: "File Head Program" Write a program that asks the user for the name of a file. The program should display the first ten lines of the file on the screen (the “head" of the file). If the file has fewer than ten lines, the entire file should be displayed, with a message indicating the entire file has been displayed. Lab Help: Use the following two files to test your...
One example of computer-aided design (CAD) is building geometric structures inter- actively. In Chapter 4, we will look at ways in which we can model geometric objects comprised of polygons. Here, we want to examine the interactive part. Let’s start by writing an application that will let the user specify a series of axis- aligned rectangles interactively. Each rectangle can be defined by two mouse positions at diagonally opposite corners. Consider the event listener canvas.addEventListener("mousedown", function() { gl.bindBuffer(gl.ARRAY_BUFFER, vBuffer); if...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...
How can we assess whether a project is a success or a
failure?
This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...
I need Summary of this Paper i dont need long summary i need
What methodology they used , what is the purpose of this paper and
some conclusions and contributes of this paper. I need this for my
Finishing Project so i need this ASAP please ( IN 1-2-3 HOURS
PLEASE !!!)
Budgetary Policy and Economic Growth Errol D'Souza The share of capital expenditures in government expenditures has been slipping and the tax reforms have not yet improved the income...
Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...
First, read the article on "The Delphi Method for Graduate Research." ------ Article is posted below Include each of the following in your answer (if applicable – explain in a paragraph) Research problem: what do you want to solve using Delphi? Sample: who will participate and why? (answer in 5 -10 sentences) Round one questionnaire: include 5 hypothetical questions you would like to ask Discuss: what are possible outcomes of the findings from your study? Hint: this is the conclusion....