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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:14:14+00:00 2026-06-05T11:14:14+00:00

After doing some opencv operation, I initialize a new image that I’d like to

  • 0

After doing some opencv operation, I initialize a new image that I’d like to use. Saving this empty image gives a weird result

enter image description here

The lines I use to save this image are:

Mat dst2 (Size (320, 240), CV_8UC3);
imwrite("bla.jpg", dst2);

I should get a black image, but this is what I get. Moving these two lines to the start of the program everything wordks fine
Anyone had this problem before?

I just noticed that these white lines contain portions from other images I’m processing in the same program

Regards

  • 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-05T11:14:16+00:00Added an answer on June 5, 2026 at 11:14 am

    Because you did not initialize the image with any values, you just defined the size and type, you will get random pixels (or not so random, it is probably showing pieces of pixels in memory).

    It is the same concept of using/accessing an uninitialized variable.

    To paint the image black you can use Mat::setTo, docs here:

    http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-setto

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

Sidebar

Related Questions

Update: I updated this after doing some digging and realizing that this might be
After doing some research I feel this should work, however it is not saving
This seemed like a common question but after doing some searching, I wasn't really
I'm getting a getaddress error and after doing some sleuthing, it looks like it
I got this message when doing some javascript programming, and after some google searches,
After doing some search on SO, Google and MSDN forums I've become frustrated that
I have a program that returns a comma-separated string of numbers after doing some
After doing some research, it would seem that errno 150 occurs when either table
After doing some processing on an audio or image array, it needs to be
After doing some changes to my plugin amtyThumb , I realized that there is

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.