Question
I need help with MATLAB programming. I am working on a image tampering project that checks for tampered images. I am currently using two cameras
I need help with MATLAB programming. I am working on a image tampering project that checks for tampered images. I am currently using two cameras for my project that is the Cannon or Nikon. In my M file, it shows what camera I am running, and the picture that is pristine. It then checks for any tampering and shows the results. I have a GUI, and I want it to work by having the user select the camera type, and photo, and have it send the information over to the m file. The project folder already has set folder of images made. How is this possible? PLEASE HELP ME.
M file:
% % Demo for the forgery localization algorithm based on PRNU % by G. Chierchia, G. Poggi, C. Sansone and L. Verdoliva, % ''A Bayesian-MRF Approach for PRNU-based Image Forgery Detection'' % IEEE Transactions on Information Forensics and Security, 2014. % % clear all; close all; clc; directory = fileparts(which(mfilename())); addpath( genpath(fullfile(directory, 'code')), '-end' );
% input image % camera: CanonEOS_10D or Nikon_D200 % photo: img0i.jpg (i=1,2,3,4) camera = 'CanonEOS_10D'; photo = 'img01.jpg';
% parameters %filterName = 'mihcak'; filterName = 'bm3d';
opt_mrf.likelihood = 'bayes'; opt_mrf.norm = 'L1'; % alternative option: L1 opt_mrf.decimate_factor = 1; opt_mrf.dilate = 20;
% N.B. the following parameters are camera-dependent opt_mrf.beta = 120; opt_mrf.p0 = 0.5;
% load image [tmp,photoname] = fileparts(photo); x_pristine = imread(fullfile(directory, 'photos', camera, 'pristine',[photoname,'.jpg'])); x_forged = imread(fullfile(directory, 'photos', camera, photo )); x_mask = imread(fullfile(directory, 'photos', camera, 'masks', [photoname,'.mask.png']));
% load data pattern = load(fullfile(directory, 'data', camera, ['pattern_',filterName,'.mat']) ); hypothesis = load(fullfile(directory, 'data', camera, ['hypothesis_',filterName,'_R64.mat']) );
% detection getResidue = makeResidueFun(pattern.filterOpt{:}); mask_mrf = detect_forgery_mrf( x_forged, pattern.prnu, getResidue, hypothesis, opt_mrf); % show figure; subplot(1,3,1); imshow(x_pristine); title('Original'); subplot(1,3,2); imshow(x_forged ); title('Tampered');
[col_mrf,map] = getFalseColoredResult(mask_mrf, x_mask); measure_mrf = getEvaluationMeasures(mask_mrf, x_mask), subplot(1,3,3); imshow(col_mrf,map); title( sprintf('Output (FM=%2.2f%%)', .... measure_mrf.FM*100) );
MATLAB GUIDE GUI:
function varargout = gui(varargin)
% GUI MATLAB code for gui.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI.M with the given input arguments.
%
% GUI('Property','Value',...) creates a new GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help gui
% Last Modified by GUIDE v2.5 29-Mar-2018 18:21:13
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui_OpeningFcn, ...
'gui_OutputFcn', @gui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before gui is made visible.
function gui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to gui (see VARARGIN)
% Choose default command line output for gui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = gui_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
demo_forgerylocalization; %m file to be executed.
% --- Executes on button press in togglebutton1.
function togglebutton1_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename pathname] = uigetfile({'*.txt'},'File Selector');
fullpathname = strcat(pathname, filename);
text = fileread(fullpathname);
set(handles.text2, 'String', text)
set (handles.text3, 'String', text)
% Hint: get(hObject,'Value') returns toggle state of togglebutton1
% --- Executes on button press in togglebutton2.
function togglebutton2_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename pathname] = uigetfile({'*.txt'},'File Selector');
fullpathname = strcat(pathname, filename);
text = fileread(fullpathname);
set(handles.text2, 'String', text)
set (handles.text3, 'String', text)
% Hint: get(hObject,'Value') returns toggle state of togglebutton2
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
gui.fig File Edit ViewLayout Tools Help IMAGE TAMPERING DETECTION PROGRAM ? CREATED BY SHAN SHAZAD AND FAHAD WAHID ! IIT 2018 EDIT THT UPLOAD TAMPERED IMAGE TOL SELECT CAMERA TYPE CANONEOS_10D UPLOAD PRISTINE IMAGE RUN gui.fig File Edit ViewLayout Tools Help IMAGE TAMPERING DETECTION PROGRAM ? CREATED BY SHAN SHAZAD AND FAHAD WAHID ! IIT 2018 EDIT THT UPLOAD TAMPERED IMAGE TOL SELECT CAMERA TYPE CANONEOS_10D UPLOAD PRISTINE IMAGE RUNStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started