Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7605583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:12:13+00:00 2026-05-31T00:12:13+00:00

I want to perform an image resize using bicubic interpolation. However, my output image,

  • 0

I want to perform an image resize using bicubic interpolation. However, my output image, new_img looks exactly the same as my original loaded image, img. Also, when I found the width and height of new_img, it has the same dimensions as my original image. I thought that the destination image was supposed to have been resized?
This is my code. Would someone see if I have done anything inaccurately please? Thank you in advance.

#include "cv.h"
#include "highgui.h"
#include "iostream"

using namespace std;
int main( int argc, char* argv ) {
IplImage* img = NULL;
const int maxScale = 1;
img = cvLoadImage("C:\\walk mii.jpg");
if (!img){return -1;}
for(int s = 1; s <= maxScale; s++)
{
    IplImage* new_img = img;
    if( s > 1 ) {
        new_img = cvCreateImage(cvSize(img->width*s,img->height*s), img->depth, img->nChannels );
        cvResize( img, new_img, CV_INTER_CUBIC );}
    cvNamedWindow( "original", CV_WINDOW_AUTOSIZE );
    cvShowImage( "original", img);
    cvNamedWindow( "result", CV_WINDOW_AUTOSIZE );
    cvShowImage( "result", new_img);

    CvSize dim = cvGetSize(new_img);
        cout <<" dimensions:: height:" <<  dim.height<<" width:"<< dim.width<< endl;

    cvWaitKey(0);
    cvReleaseImage( &img );
    cvReleaseImage( &new_img );
    cvDestroyWindow( "result" );
    return 0;
    }
}

Altered code:

#include "cv.h"
#include "highgui.h"
#include "iostream"

using namespace std;
int main( int argc, char* argv ) {
IplImage* img = NULL;
IplImage* new_img = NULL;
img = cvLoadImage("C:\\walk mii.jpg");
if (!img){
    return -1;}
new_img = cvCreateImage(cvSize(img->width,img->height), img->depth, img->nChannels );
cvResize( img, new_img, CV_INTER_CUBIC );
cvNamedWindow( "original", CV_WINDOW_AUTOSIZE );
cvShowImage( "original", img);
cvNamedWindow( "result", CV_WINDOW_AUTOSIZE );
cvShowImage( "result", new_img);

CvSize dim = cvGetSize(new_img);
cout <<" dimensions:: height:" <<  dim.height<<" width:"<< dim.width<< endl;

cvWaitKey(0);
cvReleaseImage( &img );
cvReleaseImage( &new_img );
cvDestroyWindow( "result" );
return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:12:15+00:00Added an answer on May 31, 2026 at 12:12 am

    IplImage* new_img = img; does a shallow copy so new_img and img point to the same data

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to perform an image upload with Symfony2. I followed the cookbook entry
I am uploading images using servlet. To perform resize operations i am converting InputStream
So I'm using command line execs with php to perform Image Magick converts, and
Im using EMGU (opencv wrapper) for image processing. I want to load images one
I want to perform the following task using JSF / Richfaces On click of
I am using OpenGL ES to perform drawing in an Android app. I want
I want to perform different actions on different image views which are created dynamically
i am performing search condition of image file & using print_r() it shows output
I want perform a easy task in android, which when receiving a call the
I want to perform rubyf action in VIM when I press F5 if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.