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 7931061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:36:50+00:00 2026-06-03T20:36:50+00:00

Mat img=imread(image_location); I studied that ‘img’ variable is like an object reference variable in

  • 0
Mat img=imread("image_location");

I studied that ‘img’ variable is like an object reference variable in java which refers the original object(an image in this case).
Out of curiosity i thought to find out what the ‘img’ variable holds.If it refers to the actual object,it should hold an address and return the address when i use

cout<<img;

But,Shock,it is returning the actual image(pixel values) to the output.
I think there is something wrong with my understanding.
Plz help,I’m a noob programmer who’s trying to make my brain understand these concepts.

  • 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-06-03T20:36:52+00:00Added an answer on June 3, 2026 at 8:36 pm

    cv::Mat holds the data representing the image in an array, plus other data specific to the cv::Mat instance. The data array itself depends on the image’s format. You can have different numbers of channels and channel depth, and when you use imread you can pass a second parameter that gives you some control over this. So cv::Mat does not have a pointer to the original object, it has a pointer to an array containing data representing that object.

    On top of that, in newer versions of OpenCV, the ostream& operator<< is overloaded for cv::Mat, and that tries to produce a nice printout of the array values in matrix format. This is what you see when you std::cout << someMat;

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

Sidebar

Related Questions

Is there a way to stream video with opencv faster? i'm using Mat img;
I have a .mat file that I want to open and see its contents.
I have a matrix mat and would like to calculate the mean of the
I would like to map one triangle inside an OpenCV Mat to another one,
Is there a way to combine 2 vectors in MATLAB such that: mat =
i have a file, filedata.mat, containing a 1x1 struct with sub-levels that contain data
I have a matrix: mat = [ 2009 3 ; 2010 2 ] ;
I have: typedef void (*RespExtractor) (const cv::Mat & image, cv::Mat & resp); virtual void
Is it possible to read .mat file in android ? how should I convert
I have a fairly simple question: how to take one row of cv::Mat and

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.