|
The place for regular C++ questions at The Code Project is here[^].
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hiya
I would like to know 2 different methods of image resizing. One simple and one complex.
And then i have to implement those methods via programming in C++.NET.
And it would be great if some one could refer me some source code to understand it in detail. I am newbie to Image Processing.
Thanks a lot....
|
|
|
|
|
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Drawing::Drawing2D;
using namespace System::Drawing::Imaging;
...
Bitmap ^pSrcBitmap = gcnew Bitmap("C:\\test.bmp");
Int32 DestImageWidth = pSrcBitmap->Width * 2;
Int32 DestImageHeight = pSrcBitmap->Height * 2;
Bitmap ^pDestBitmap = gcnew Bitmap(DestImageWidth, DestImageHeight, pSrcBitmap->PixelFormat);
Graphics ^pDestGraphics = Graphics::FromImage(pDestBitmap);
pDestGraphics->InterpolationMode = InterpolationMode::HighQualityBicubic;
pDestGraphics->CompositingMode = CompositingMode::SourceCopy;
pDestGraphics->DrawImage(pSrcBitmap, 0, 0, DestImageWidth, DestImageHeight);
pDestBitmap->Save("C:\\testresized.bmp");
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Drawing::Drawing2D;
using namespace System::Drawing::Imaging;
...
Bitmap ^pSrcBitmap = gcnew Bitmap("C:\\test.bmp");
Int32 DestImageWidth = pSrcBitmap->Width * 2;
Int32 DestImageHeight = pSrcBitmap->Height * 2;
Bitmap ^pDestBitmap = gcnew Bitmap(DestImageWidth, DestImageHeight, pSrcBitmap->PixelFormat);
BitmapData ^pSrcBitmapData = pSrcBitmap->LockBits(Rectangle(0,0,pSrcBitmap->Width,pSrcBitmap->Height),
ImageLockMode::ReadOnly, pSrcBitmap->PixelFormat);
BitmapData ^pDestBitmapData = pDestBitmap->LockBits(Rectangle(0,0,DestImageWidth,DestImageHeight),
ImageLockMode::WriteOnly, pSrcBitmap->PixelFormat);
<code>
pSrcBitmap->UnlockBits(pSrcBitmapData);
pDestBitmap->UnlockBits(pDestBitmapData);
pDestBitmap->Save("C:\\testresized.bmp");
-- modified at 12:56 Tuesday 5th June, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
What methods are these. Well is the complex one bilinear interpolation method.
If its not then is it possible for you to tell me with bilinear interpolation one. And yeh it would be great if you could provide me with few good links aswell to underrstand the theory behind it...
As i have to compare the both methods...and point out advantages n disadvantages of both...
Thnaks
|
|
|
|
|
|
My image processing articles cover bilinear interpolation. You'd have to convert the code from C#, which should be easy.
I cover the theory, also. There are on this site.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sorry Christian!
I forgot about this article[^]. I'll try and remember to post the link in the future
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
OK great...Thanks ....Ill go through it and would try to figure out advantages n disadvantages of 2 different approach...a simple and a bilinear one....
Thanks a lot..
|
|
|
|
|
Software_Specialist wrote: a simple and a bilinear one
I didn't mention, a simple solution is to duplicate pixels when increasing size and remove pixels
when reducing size, not taking into consideration nearest neighbor or anything.
This is the easiest to code but the resulting image, especially when increasing size, is the
poorest (pixelated, "blocky").
Good luck!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Are you using C++/CLI, or vanilla C++ in VS2005 ? You also seem to be asking people to do an assignment for you, why can't you find this info for yourself ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
what...?
I never asked any one to do my assignment....???? It could be a part of assignment but not the whole assignment...??????? But it is not any assignment...i am just startin teaching myself IP...so its a step1. Yeh but to get started i read this question somewhere...
I did find this info myself aswell...d only reason i put this up was bcos i was not sure of the different methods ...later i found out that bilinear interpolation is one of d complex method...so to make sure i ws right i put up a question here......And its always better to take some pre info before you start working over any new area and thats wt i did.. I am starting up with Image processing , speech processing and stuff...And i guess its right to ask some one experienced like urself....who could push me to the right direction....I mostly work over C#.net and recently only i started with MFC n all...
Anyway from next time i would mention what all info my google friend gave me and in what area i am confused...
Thanks for replying to my post...Problem solved.....
SS
|
|
|
|
|
does anyone know how to copy data from one listbox(several columns) to another one?
Thanks In Advance;
|
|
|
|
|
If this is .NET, then the listboxes have an Items property. If it's not .NET, you'r in the wrong forum
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello every body ..
If you can I need a cod to search in a text file ....
I need it to search of word which contin of 3 word ..
can you help me I try but I cant write it ...
plase help me as soon as you can ...
non light
|
|
|
|
|
This is the C++/CLI forum. Try the Visual C++ forum, but first try doing a little research. You should ask a question which explains what you've tried. The fstream class is the best way to read a file, and you can read a file word by word with it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
class Complex{
public:
Complex();
Complex(double);
Complex(double,double);
void write() const ;
bool operator==(const Complex& ) const ;
bool operator!=(const Complex& ) const ;
Complex operator-();
friend ostream& operator<<(ostream& out,Complex& c);
private:
double real;
double imag;
};
Complex::Complex(){
real=imag=0.0;
}
Complex::Complex(double re){
real=re;
imag=0.0;
}
Complex::Complex(double re,double im){
real=re;
imag=im;
}
void Complex::write() const {
cout<<real<<"+"<<imag<<'i'<<endl;
}
bool Complex::operator==(const Complex& u ) const {
if(real==u.real&&imag==u.imag)
return true;
else return false;
}
bool Complex::operator!=(const Complex& u ) const {
if(real!=u.real||imag!=u.imag)
return true;
else return false;
}
Complex Complex::operator-(){
real=-real;
imag=-imag;
}
ostream& operator<<(ostream& out,const Complex& c)
{
return out<<c.real<<"+"<<c.imag<<'i'<<endl;
}
int main(){
Complex c1(2.3,5.6);
Complex c2(1.4,2.5);
if(c1==c2) {
c1.write();
c2.write();
cout<<c1<<endl;
cout<<c2<<endl;
}
return 0;
}
I have declared :friend ostream& operator<<(ostream& out,Complex& c);
but why the error says:
cannot access private member declared in class 'Complex'?
|
|
|
|
|
This is a well asked question, but this is the C++/CLI forum, try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Isn't it C++ forum?
|
|
|
|
|
"The C++ / CLI is for managed and mixed-mode C++ programming only " says the sticky post at the top of the forum. If you read that post, you'll see that it's for exactly what the name says - managed C++ and C++/CLI. This is C++ that uses the .NET framework. The visual C++ forum is for straight C++ questions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
in C# it's possible to get a handle to a process by doing:
Process[] p = Process.GetProcesses();
and checking each process in 'p' to find a specific one by its using 'ProcessName' property.
Does someone now how to that in C++ to search for a specific process ?
Thanks a lot !
Pat.
p.f. Goudjo-Ako
Bringing our energy together !
|
|
|
|
|
In managed C++ you do it the same - it's the same .NET Process class.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Assuming that you mean in standard C++, you're in the wrong forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
One of my co-workers has had an interesting problem with an application that does lots of text processing. The text processing takes a long time to complete once kicked off (it runs on several gigs of data).
When doing a basic UI for it he set a button on a form that would start this long process (didn't use a background worker, its running in the UI's thread). At this point when watching the processes memory usage it was increasing very fast (around 3 MB's per second).
Then an interesting observation was made ... if a message box was shown after the initial processing had started, the memory usage would go down to a normal level and then for the rest of the processing it would hold solid.
The only way that makes sense to me is if the garbage collector wasn't actually freeing the memory for some reason, until the message box appeared. My guess is that this has something to do with the fact that the processing was being hosted in the UI's thread and not in a worker thread.
We created a console application to do the same processing and it has a stable amount of memory use for the entire time it takes to run.
Has anybody here seen anything else like this where UI threads cause garbage collection not to clean things up ... or at least have an idea of what the main cause of this problem is?
Truly wise men don't play leap frog with Unicorns.
|
|
|
|
|
after creating the new dialog (IDD_GET_PROFILE) and build the project i am getting the error
as
ID of the new dialog is not defined.
and if i click on the error it is pointing the
enum { IDD = IDD_GET_PROFILE };
in the .h file of the project.
the id is defined automatically in the resource.h file
where else we need to define the ID?
how to solve the problem?
Help Ever Hurt Never
|
|
|
|
|
This question should be on the C++/MFC board, not the managed C++ board.
The compiler needs to know what the value of IDD_GET_PROFILE is at the point of the enum
declaration. The resource editor usually puts these in resource.h so make sure you've included
that file somewhere before you try to use IDD_GET_PROFILE.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|