Visual C++ :: Dimensions Of JPEG In Memory?
Feb 18, 2013
I have a JPEG in memory as a char* and a bytesize, if I save it to disk with a .jpg extension it's a perfect JPEG file. The thing is, I don't want to save it unless it's a minimum width/height. I got it into memory using a socket recv() call. What should I do ?
View 6 Replies
ADVERTISEMENT
Sep 27, 2012
I'm very good with hmtl now i want develop with C++ i need to insert jpeg into .cpp and insert movie flash in file .h ....
View 14 Replies
View Related
Mar 20, 2014
Which command should i use for displaying a jpeg image in Visual Studio 2008 (VC++)?In the past i used LoadImage function for displaying Bitmaps.
View 14 Replies
View Related
Dec 16, 2013
Write a function that takes a picture and two integer values and stretching the image by dimensions.
View 8 Replies
View Related
Jul 3, 2013
Code:
#ifndef CIRCLE_H
#define CIRCLE_H
class Circle {
public:
//constructors
Circle();
Circle(double r);
[code]....
The function isBigger() returns true (or false) if the radius of the Circle instance on which the function is invoked is bigger (or smaller) than the radius of the Circle instance passed to the function.: How to implement this function?
View 5 Replies
View Related
Oct 29, 2013
If I have a one-dimensional array of length 10, vector<int> x, and I want to assign all the elements to value 5, then I can do the following:
Code:
vector<int> x(10);
x.assign(10, 5);
(I can also do this in x's constructor, but in my scenario I want to repeatedly assign x's elements in a loop, without having to construct a new vector in memory each time.)
If I now have a two-dimensional vector, vector<vector<int> > y, and I want to assign the first vector to length 20, the second vector to length 10, and each element in the second vector to value 5, then I can do the following:
Code:
vector<vector<int> > y(20, vector<int> (10));
for (int i = 0; i < 20; i++) {
y[i].assign(10, 5);
}
But is it possible to do this without the loop? Can I make the two-dimensional assignment in just one line, in the same way that the one-dimensional assignment was made?
Perhaps it would like something like the following, which is not correct but illustrates what I mean:
Code:
y.assign(20, assign(10, 5));
Another way of doing this would be the following:
Code:
y.assign(20, vector<int> (10, 5));
But wouldn't this cause the memory in the second array to be dynamically allocated each time? I don't want to do this - I want to keep the same memory, but just assign the elements to 5.
View 1 Replies
View Related
Jan 6, 2015
I am writing a piece of code that simulates a random walk in 2 dimensions (an object chooses whether to move up, down, left or right randomly). I would like the program to run the simulation for many objects at the same time. The way i have written it means that for every object i add the code becomes about 40 lines longer. Any method that would simplify the code so that i could have many objects but not pages and pages of code.
#include <ctime>
#include <cstdlib>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<fstream>
using namespace std;
double dist(int a, int b);
[Code] .....
View 5 Replies
View Related
Nov 14, 2013
This is my code and it's not giving me the right output
Code:
#include <stdio.h>
int main() {
int dim;
int i, row, col;
// inputting matrices dimensions
int M0, M1, M2;
[Code] ....
The output should give me this:
Input 2
Correct Output 2 5 4 10
View 10 Replies
View Related
Dec 9, 2014
How to read a grayscale jpeg image in C++ ?
How do I write the code to read the jpeg file and store its content in a 2D array
View 1 Replies
View Related
Nov 8, 2013
So the latest challenge from jumping into c++ is as following.
Code:
Write a function that builds the multiplication table of arbitrary dimensions This chapter also talks a ton about 2d arrays.
So I've built my program thus far as this.
Code:
#include <iostream>
using namespace std;
int drawTable(int,int);
int main()
[Code] .....
So basically, the idea is that I can use the arrays dimensions as a placeholder, and just multiple them to get that specific spot, so table[0][0] = 0, [0][1] = 0 and so on. However the output actually seems to be randomly generated numbers so I'd like to ask, what am I doing wrong? Am I on the right track? Or have I missed the bus stop completely.
View 12 Replies
View Related
May 3, 2013
How to include a jpeg file into a c++ program??
View 2 Replies
View Related
Nov 13, 2014
Problem in converting Jpeg to DIB, Iam using the same code for Jpeg RGB(Jpeg_color_space=JCS_RGB) and Grayscale Images(JCS_GRAYSCALE). this code works correctly for Jpeg RGB Images when i create DIB for 24 bit. But for Jpeg Grayscale(JCS_GRAYSCALE) images, when i am converting to DIB I get a Black color space next to image,but the original image does'nt contain any black space.
Following is the code i use for converting jpeg to DIB.
//Function to convert jpeg to dib.
int convert_jpeg_to_dib(const char * filename) {
struct jpeg_decompress_struct cinfo;
unsigned char * buffer;
int result = 0;
struct my_error_mgr jerr;
FILE * infile; /* source file */
int row_stride; /* physical row width in output buffer */
[Code] .....
View 1 Replies
View Related
Oct 2, 2013
What I'm trying to accomplish is to ask the user what their floor plan is (in square feet), have them pick what kind of material they want and give them a general price.
Which is working out great so far, but I would also like to add a loop at the end that cycles back if they want to re-do the estimate with a different material selection and if not exit out the program.
I've been trying do while and if/else loops but i can't get them to work right.
#include <iostream>
#include <string>
using namespace std;
int main() {
string custName, selection;
int custNumber, floorSize, material, contactSystem;
[Code] ....
That's basically what I've come up with so far minus all the erroneous attempts. Though as is I technically complete the assignment, I would like the extra credit from making the last part loop.
View 1 Replies
View Related
Feb 28, 2014
I'm trying to read a jpeg pixel and then compare it if it'x bigger than a number to change it. Either I'm breaking the folder if I start less than 22000 which is very large number shouldn't include the header or I'm getting solid color without any different.
Code:
const char* filename ="Hydrangeas.JPG";
const char* nfilename ="Hydrangeas1.JPG";
FILE *ptr_old, *ptr_new;
errno_t err = 0, err1 = 0;
int a;
[Code] ....
View 5 Replies
View Related
Jan 6, 2015
I need to save RGB values of each pixel in a 3D array A[width][height][3]. I found a code online that transfers the bytes into an array but I cant understand how bytes are saved them so i could transfer them into an array. The truth is I dont know much about working with images at all so i have a problem working on them. How to transfer the RGB data from an .jpeg image into a 3D array? This is my code so far:
#include <iostream>
#include <jerror.h>
#include <jpeglib.h>
using namespace std;
int main(){
FILE *pic = fopen( "image.jpeg", "rb+" );
[Code] .....
View 6 Replies
View Related
Nov 17, 2013
I am trying to write a c file to decompress jpeg images in android aokp source
Sample from my c code:
...
#include "jpeglib.h"
...
int main() {
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
[Code] ....
libjpeg source I am using: [URL] ....
Compiling goes fine, but the linker always fails:
undefined reference to 'jpeg_std_error'
undefined reference to 'jpeg_CreateDecompress'
How can I get it working?
View 1 Replies
View Related
Apr 17, 2014
I was trying to capture entire web screen and save as .jpeg format.
So far I have done this using C# Windows Application.
Same thing I am willing to do in 'VC++ 2010 Win32. In my C++ project I have created a Toolbar with a button on IE 9 browser. And on Toolbar button click I can print current window.
But I don't know how to take a snapshot and save to specified directory in .jpeg format using VC++ 2010. I have Windows 7.
View 4 Replies
View Related
Oct 26, 2014
I have created TIFF Reader using libtiff in c++. Now I have many tiff files with old-style jpeg compression that has to be read/open using libtiff in c++.
I guess, as "old-style" JPEG compression is deprecated in TIFF, because it was never fully specified. And because of this under-specification, various vendors implemented it in different, incompatible ways. Support was dropped in favor for TIFF compression 7, JPEG.
Unfortunately,old TIFF files using this compression still exists.
View 5 Replies
View Related
Apr 21, 2013
I use Visual C++ to write a native C++ application. How to know the maximum memory it will use during its execution?
View 5 Replies
View Related
Oct 26, 2013
I am using CByteArray as a buffer in Visual C++. I want to preallocate nSize memory for for CByteArray, so that later when I try to change the buffer, by calling SetSize, Add, Remove, etc., as long as all these operations are within nSize, CByteArray will not try to release the memory or reallocate the memory, so to eliminate the possibility of memory fragments in heap. Is that possible?
View 5 Replies
View Related
Mar 4, 2015
I am developing a Visual C++ application. There is an object called CMyObject, as follows:
typedef CMap<UINT, UINT, void *, void*> CMyMap;
class CMyObject {
public:
CMyMap *m_pMyMap;
"Some other member variables"
}
Some instances of CMyObject contains a map, some not. Therefore, to save memory, I define a pointer m_pMyMap and create a new CMap object only if the instance contains a map.
When I test my app, with the increase of the CMyObject instance, the number of memory blocks allocated and deallocated is also increasing. There are a lot of fragments during this period. To prevent this, I try to override the new/delete operator for CMyObject and CMyMap. But still find many fragments. So I try to trace into the MFC source codes for CMap. I find CMap is just using an internal buffer to store the hash table(m_pHashTable), as follows:
m_pHashTable = new CAssoc* [nHashSize];
And for each hash entry, it uses:
P = (CPlex *)new BYTE[sizeof(CPlex) + nMax *cbElement];
To allocate the spaces.
I believe these two may be the reason of the memory fragments and want to eliminate them. However, is there a way to override the new/delete operator for codes such as:
new CAssoc* [nHashSize]
and
(CPlex *)new BYTE[sizeof(CPlex) + nMax *cbElement]
So that the spaces will be allocated from my own memory manager instead of from the default heap?
View 1 Replies
View Related
Apr 29, 2013
I know memory leak checking can sometimes have false positives. I turned on memory leak checking by adding
Code:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
Then calling
Code:
_CrtDumpMemoryLeaks();
in the App's constructor.
I traced the issue back to the constructor for a variable included in the app class. The variable is a class I declare in the project.
Code:
//Class declaration
#define NUM_MT_COLORS 16
struct clrTable {
COLORREF clrCode;
CString clrName;
[Code] ....
I get a memory leak error for every instance where a CString is set. I tried moving this to the MainFrame just to see if there was something with this being in the app, and saw the same memory leak errors.
I didn't include the functions in this class that manipulate this table. I didn't put it in the document because this is a multi-doc application and this table is universal to the program.
Is this an example of a false positive in the memory leak checker, or did I do something wrong?
View 7 Replies
View Related
Dec 20, 2012
when ending my app in the debugger, memory leaks will be shown like this:
Detected memory leaks!
Dumping objects ->
C:PROGRAM FILESVISUAL STUDIOMyProjectsleaktestleaktest.cpp(20) : {18}
normal block at 0x00780E80, 64 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.
How can I tell Visual c++ also to show me the memory leaks in a called dll?
View 14 Replies
View Related
Feb 27, 2014
I have a MFC app that has a CDHtmlDialog embedded in it. During run time i update the HTML content from the C++ code. There's a IMAGE tag in the content and the SRC for the tag is updated multiple times in a second to show different images.
Basically i go over a WHILE loop in the C++ and call a JavaScript function to update the "src" for the "img" tag.
The issue am seeing is that, after running this code for a while the application kinda hangs and the system takes up lot's of memory.
How to solve this, as all the code that's in the browser side of app is HTML & JavaScript. I looked through the C++ code plugged all memory leaks there.
View 1 Replies
View Related
Oct 31, 2013
When running my code in Visual Studio, there is a particular point in the code where my program is crashing. To debug this, I am adding a break point in Debug mode just before that point, and observing what happens as I step through the code. However, to get to this break point in the code takes about a minute of running the program. So I'm wondering if there is a tool in Visual Studio to reload the state of a program's memory from a previous run, so that I can immediately get to the break point without having to wait for a minute each time?
View 6 Replies
View Related
Mar 23, 2013
I am trying to use PCA, but it gives memory access violation error. Here is my sample code.
Code:
int main(...) {
.................
vector<float>input_array;
for(i=0;i<number_of_lines;i++) {
for(j=0;j<feature_vector_size;j++) {
input_array.push_back(read_feature[i][j]);
[code]....
View 1 Replies
View Related