Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
Interpolating a zoomed in colorscale image in Matlab
Reply to thread
Message
[QUOTE="RMZ, post: 5496914, member: 516195"] I have no idea what I am doing wrong. I have already found multiple places on the internet which give clear examples of how to do this, yet I am still struggling. Please help me out, or at least point me somewhere. My code is below. I am trying to interpolate pixels of a full color image. The only issue I am having is to display the final 3D matrix representing (what should be) a much clearer version of the original low quality image. During my troubleshooting, I tried displaying individual channels, yet was unable to (almost the entire image shows up as either red, green, or blue depending on which channel I attempted to display). However, displaying individual channels as 2D matrices (e.g. imagesc(newData(:, :, 1)) ) works albeit with an odd set of colors. I have verified in my workspace that the image pixels are being interpolated properly. The image I have been working with is attached. function I am = displayRGB(filename) %obtain original picture and zoomed picture information imData = imread(filename); zoomData = imData(200:300,200:300,:); %creating a grid corresponding to existing pixel values, as % well as for pixel values to be interpolated [height,width,dimension] = size(imData); X = 1:width; Y = 1:height; [X0,Y0] = meshgrid(X,Y); [X1,Y1] = meshgrid(200:.25:300,200:.25:300); %interpolate each channel newData = zeros(401,401,3); newData(:,:,1) = interp2(X0,Y0,double(imData(:,:,1)),X1,Y1,'cubic'); newData(:,:,2) = interp2(X0,Y0,double(imData(:,:,2)),X1,Y1,'cubic'); newData(:,:,3) = interp2(X0,Y0,double(imData(:,:,3)),X1,Y1,'cubic'); %display the image figure; imagesc(zoomData) %original zoomed image figure; imagesc(newData) %clearer image [/QUOTE]
Insert quotes…
Post reply
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
Interpolating a zoomed in colorscale image in Matlab
Back
Top