Visual C++ :: Analyze Bitmap - Concept For Saving Data

May 18, 2014

I would like to create program which will analyse bitmap so would need good concept to save data. I am interested about the theory and I realize that i must to think this carefully because bad concept could create insufficient memory or inefficient program. Basically I want my program work with HSV or HSL model so I would need to convert the bitmap to HSL, but I am not sure if I should convert it first and then analyse all pixels or should I start to analyse the bitmap and make the conversion to HSL during it. But my main question is what method to choose to save the data in memory.

Even that I would start with very small, it should work also with bigger image like image having 1200 or even 4200 px on height. So the program should first analyse all columns of pixels in the image so for example 1200x800 px image has 1200 columns. So I would like to know if is it possible to create such object which would have such structure like this

Obj->basicColumnData->black->columns[name]->group

and in the place of columns should be placed data for every column. I would look for groups of pixels in the column, so in the result the column x could bear e.g. 500 groups of information and every group should contain the range of pixels e.g. group 1 should contain y value from 0 to 20, group 2 should contain value from 25-27 and so on. So I would create 1200 columns bear many of groups. This would be contained in "black" or "white" member to contain the data. This is just simplified idea, but the whole object should contain next data not just basicColumnData... So there should be another members bearing information calculated from the selected data.

So my question is what kind of method of saving data use for this? Should I use heap and dynamic allocated memory or should I create custom class, which will define every member, but these members will have to be dynamic memory? With the dynamic memory is there problem that there could be not enough memory to create such big object?

View 5 Replies


ADVERTISEMENT

C++ :: Analyze And Elaborate Data From Particle Energy Measurements

Oct 13, 2013

I have to analyze and elaborate datas from particle energy measurements. I have a file txt like this

1 126 17 20 23 32 39 55 68 81 98 111 129 141 151 164 170 182 180 183 187 187 181 186 178 174 175 172 163 159 155 147 140 138 128 122 105 100 99 87 80 66 59 55 48 42 40 33 31 25 25 22 19 19 18 15 15 16 15 16 15 13 13 14 14 14 14 13 13 14 14 13 15 15 14 15 14 14 13 12 13 14 13 14 14 14 13 14 14 13 12 13 13 13 13 14 13 13 13 13 14 14 14 13 13 14 14 14 12 12 13 12 13 11 12 13 12 13 14 12 12 12 11 13 12 13 13 15

2 124 20 34 9 34 51 50 61 76 71 69 95 99 108 103 101 95 89 117 98 107 76 86 66 97 97 80 17 54 45 44 39 40 18 13 29 20 16 15 15 16 14 15 16 16 15 15 14 13 12 14 14 14 12 14 13 12 15 12 12 14 14 11 12 12 14 12 12 13 12 12 13 12 12 12 13 12 13 13 13 12 14 12 12 13 10 12 13 12 13 13 13 12 12 12 13 12 12 13 12 10 15 13 13 12 14 12 12 14 12 12 13 13 13 12 12 12 11 11 13 14 12 12 12 13

The first two numbers are the Particle ID and its Energy, the rest of numbers are the loss of energy(different in number for every particle).

I have to elaborate 1000 events like this and to create a function able to read every line and to count the number of the loss energy measurement.

I use ifstream to read a file text, but my problem is: my program how to understand that it's passing to the new line? I have to divided every events in Arrays of different length, so i have to count each data for every particle and then create the array.

The instruction EOF it's not good...

View 5 Replies View Related

C# :: How To Pass Bitmap Data Type To DLL

Jun 24, 2014

C# Code

[DllImport("dllTestForm.dll", EntryPoint = "showFormC")]
static extern void testShowFormC(byte[] photo,int len);
private void button6_Click(object sender, EventArgs e) {
Bitmap bmp = (Bitmap)Image.FromFile(@"d:11.jpg");
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);

[Code] ....

The program has no tip errors ,But there is no any picture display in c++ form,Tested the simple data types, such as int, can be normal .

View 1 Replies View Related

Visual C++ :: Loading Bitmap In Particular Way?

May 25, 2013

I have a function that essentially takes a screen shot and saves a pointer to it as a structure. I would like to use the same structure for bitmaps that I load from files.

Code:
typedef struct _BITMAPCAPTURE {
HBITMAP hbm;
LPDWORD pixels;
INT width;
INT height;
} BITMAPCAPTURE;
BOOL CaptureScreen(BITMAPCAPTURE* bmpCapture) {

[code].....

The handle to the bitmap, as well as the width and height are all easy enough to get but I'm unsure of how to get the pixels.

View 2 Replies View Related

Visual C++ :: Use Bitmap On Button Instead Of Text

Dec 15, 2013

I'm trying to create a dialog where some of the buttons have pictures on them, rather than plain text. I notice that under the button's properties, under the "styles" tab there's a checkbox "bitmap". I can't seem to find any easy way of setting a bitmap.

View 4 Replies View Related

Visual C++ :: Slow Performances Using Bitmap / GDI

Apr 17, 2014

I am trying to do this:

while(1)
{
CaptureScreenshot (as BMP)
Convert screenshot to 24 bit instead of 32 bit
Resize screenshot size
Get the BMP bits array of the resized screenshot
}

I have it working but the best i could get is 18 iteration (screenshots) per second. This is what i do:

Code:
Start() {
ULONG_PTR gdiplusToken=0;
HDC mhCompatibleDC;
HBITMAP mhCompatibleBitmap;
HWND mhDesktopWnd;
HDC mhDesktopDC;
byte*piRGB=new byte[1200*900*3]

[Code] .....

Here i do things with piRGB but these things are not counted it the timer so you can assume here the code ends . As said as the code looks now, i can fill piRGB ~18 times (18loops) in 1 second. I must improve that...

View 14 Replies View Related

Visual C++ :: How To Save Bitmap To File

May 19, 2014

I have this code, where I capture window and make copy to bitmap of it. I am working on rotation of bitmap. But my problem is that when I save the image to file the result is just a black screen. It looks like there could be some problem either in GdipCreateBitmapFromHBITMAP() or GdipGetImageGraphicsContext()

How to fix it and to get the rotated image?

Code:
// CODE 81 and 82 de facto no difference
#defineCODE85 // 81
#defineWINDOW_MIN_HEIGHT200

[Code].....

View 14 Replies View Related

Visual C++ :: Drawing Text On A Bitmap?

Oct 5, 2012

I wrote a simple clock that shows the time over bitmap as follows:

Code:
void CMyClock::OnPaint()
{
CRect rect;
GetClientRect(&rect);

[Code]....

Now I got rid off the white border but everytime I draw a text it write on top of the previous text so after few seconds everything is a mess and the time is no longer readable.

View 5 Replies View Related

C :: Saving Matrices With Data Structures?

Dec 4, 2014

I'm taking a programming class and currently we're doing data structures. Today, we discussed how to save square matrices column-wise with data structures. The teacher said that after the first few steps where you declare the structure, allocate the matrix, free it and get the dimension (which mostly make sense to me I think), you have to "get" and "set" the matrix by putting in something like

Code:
void setMatrixEntry(Matrix* A, int i, int j, double Aij) {
A->entries[i+j*A->m] = Aij;
}

[Code]....

View 7 Replies View Related

C++ :: Saving Packets Of Data To A Vector?

Jul 18, 2014

I am receiving packets of data from an ethernet cable. This is the line of code that is streaming in data from the ethernet cable:

size_t num_rx_samps = rx_stream->recv(&buff.front(), buff.size(), md, 3.0, enable_size_map);[code]

Here are the segments of me trying to push the packets onto a vector:

[code]
std::vector<size_t> processing_queue; //HERE IS WHERE I'M TRYING TO PUSH THE PACKETS ONTO A VECTOR
processing_queue.push_back(num_rx_samps);
[code]

I previously had my program saving to a .dat file (the commented out lines), but I need to change it to pushing values onto a vector so I can stream the data packets from the ethernet cable to be processed. However, the packets aren't being pushed onto the stack as I suspected. What do I need to change to push the data packets onto a vector? The following is the code:

[code]

#include <uhd/types/tune_request.hpp>
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/safe_main.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/exception.hpp>
#include <boost/program_options.hpp>

[code]....

View 1 Replies View Related

C++ :: Saving Unicode Data To TXT File

Sep 13, 2013

I have a problem when i try to save unicode to a .txt file.

I need to store in a file names that will have letters like "ăĂâÂșȘțȚîÎ"

wchar_t name []=L"ăĂâÂșȘțȚîÎ";
FILE* fang;
fang= _wfopen( L"test.txt",L"wt+,ccs=UNICODE");
fwprintf (fang, L"%ls ",name);

When i open my text file i get this: ??âÂ????îÎ

if i use
fang=fopen("test.txt","a");
I get the same result

and for
fang=fopen("ang.txt","a,css=UNICODE");
I get a runtime eroror "invalid file open mode"

View 2 Replies View Related

Visual C++ :: SDI CView Covered With Bitmap Resource?

Feb 10, 2013

I have an SDI / CView app (VS 2010). All works well until I minimize the app using the minimize button or drag it partially off of the screen. In the former instance, any attempt to restore the app results in an appcrash with a tight freeze up of the machine. In the later instance the same happens immediately.

In building the app, I scoured the web for code to accomplish the loading and display of the bitmap. After some experimentation I settled on overriding the OnPaint. Below is the code. Note that m_Map is a CBitmap member and IDB_BITMAP1 is a loaded bitmap resource.

Code:

void CMyDragViewView::OnPaint()
{
// CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CView::OnPaint() for painting messages
// http://msgroups.net/microsoft.public.vc.mfc/loading-bitmaps-into-main-window/563285
int x = m_Map.LoadBitmap(IDB_BITMAP1);
TRACE1(" x = %d
", x);
CPaintDC* dc = new CPaintDC(this);

[code]....

I suspect that the problem is OnPaint trying to repaint the bitmap which requires reloading it, but I don't know how to work around this.

View 3 Replies View Related

Visual C++ :: Draw Grid Over Bitmap In Scrollview

Jul 5, 2013

I have a CScrollView that displays a bitmap and I'm trying to draw a grid that I can turn off and on by check box and when the mouse is over a section of the grid that square highlights... I do all the drawing in the ondraw function... But when I have many grid squares it becomes slow to scroll and to highlight the square the mouse is over... I'm not sure the best way to go about this and where to place code to speed it up... The bitmap is only loaded once... But in ondraw the grid has to redraw every time scrolled and when mouse moved over a square.. In onmousemove I call invalidate so the square under mouse changes...

View 5 Replies View Related

C++ :: Saving Array Data Into Text File

Dec 4, 2013

I have a program that saves all information temporarily into memory (into the array), however, I need a permanent save solution. I have the full program working correctly, formatted perfectly, but it's missing the file array to file output.

Essentially, whenever I'm presented with the menu I'll be able to add entries, search by last name, show the entire list, and exit and save. Whenever I select option 4 the program should save to a file "address_book.txt". Whenever I reload the program, it should load from "address_book.txt" and populate the array with the preexisting data.

My question is focused on how and where I should implement the file output. What I have thus far:

#include <iostream>
#include <string.h> //Required to use string compare
#include <fstream> //Eventually used to store array into file
using namespace std;
class AddBook{

[Code] ....

View 5 Replies View Related

C# :: Access Database Connection And Saving Data

Mar 17, 2014

I want to connect an access database (.mdb) to my Windows Forms application - this I can do and I have no problems viewing my table in server explorer.

Some code example or template that I can use as a base to learn from - I have literally trawled Google and Youtube and cannot find what I am after.

What I want to do is have a basic form, 2 text boxes and a button to save the data to my database.

FirstName and LastName are the 2 boxes.

View 6 Replies View Related

Visual C++ :: Using 2D Array - Displaying Bitmap Image With Scrolling

Mar 11, 2014

My requirement is,

Read *.bmp image and displaying bitmap image with scrollbar in a MFC dialog application.

I was done using this

I was read the *.bmp image as a pixel data and stored by 2D Array,

Now i want to Display this 2D array as bitmap image with scrollbar separately in the same dialog. How can i display bitmap with scrollbar using 2D array?

View 10 Replies View Related

Visual C++ :: Bitmap Display From Buffer Received By TCP Socket

Feb 6, 2013

I want to display my image on window without saving it.

When data is received window size changes but there is no display on window.

My Code is:

Code:

int iBufferLength;
int iEnd;
int iSpaceRemaining;
int i;
iBufferLength = iSpaceRemaining = sizeof(chIncomingDataBuffer);
iEnd = 0;
iSpaceRemaining -= iEnd;

[code].....

where I'm doing wrong?

View 1 Replies View Related

C++ :: Saving RGB Pixel Data Of JPEG Image In 3D Array

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

C++ ::  Saving PNG File In Console Program / Losing Data?

Jul 18, 2013

I am working on a project that uses a web service to extract a PNG image from a web server and save it on a local machine. It's done via a system call. I can get the output of the system call to a FILE but it appears to be losing data, most notably the PNG chunk names (IHDR/PLTE/IDAT/IEND, notably). (Unfortunately piping the output to an exterior file does not work through a system call.) The end result is ~6KB smaller than the file I am intending to retrieve.

This is the code I'm using (adapted from other material I found via searches here):

ofstream png;
png.open(/*outputfile*/, ios::binary);
FILE* fp = _popen(/*SYSTEMCALL*/, "rb");
string responseString;
if(fp != NULL) {
char a[100];
while(!feof(fp)) {
fgets(a, 100, fp);
responseString += a;
}
}
_pclose(fp);
png << responseString;

Am I missing something or just doing it wrong?

View 11 Replies View Related

C Sharp :: Saving Data In SQL Server Parameter Error Showing

Jun 1, 2013

I have an application with general customer detail.

It has TextBox and radio button.

First I have used if statement then code but on first step is working fine then error is showing.

try
{
if (textBox1.Text == "")
{

[Code].....

View 5 Replies View Related

Visual C++ :: Saving Matrix To UTF-8 File

Sep 15, 2012

I have written code that saves a matrix to a utf-8 file. This code works just fine when invoked from a win32 console app, but if I attempt to use the exact same code by invoking it within a SDI Doc/View Serialize(CArchive& ar), if(ar.IsStoring), it fails, but in a somewhat unusual manner. Namely, the file shows up in the designated directory, but it is an empty file (0 bytes), and the 'Unable to open file' message is seen in Debug config. Note that both the win32 console app and the SDI app are both using a Unicode character set, however, only the SDI app uses the method inside a Serialize(CArchive& ar) method, whereas the win32 console app evokes the save method directly from within _tmain. Why this seemingly illogical disparity occurs.

Here's the template code I have used in innumerable applications to save matrices to a disk file.

Code:
namespace TNT {
// saves a TNT double matrix, discriminating between real and complex matrices by virtue of the respective file markers, 'MATCALC94R' and 'MATCALC94C'.
template <class T>
void SaveRealBMatrix(const Matrix<T> &M, string sfilename) {
_RPT0(0, "SaveRealBMatrix:
");
_RPT1(0, "sfilename =: |%s|

[Code] ....

Here's the code from the SDI document Serialize(CArchive& ar) that fails as described above. Note that m_M is a class member TNT::Matrix<double> m_M that has been verified to exist in the Serialize method.

Code:
void CMyWndDoc::Serialize(CArchive& ar) {
if (ar.IsStoring()) {
CString csFileName = ar.m_strFileName;
wstring ws = csFileName.GetBuffer(0);
string s(ws.begin(), ws.end());

[Code] .....

View 2 Replies View Related

Visual C++ :: Saving CMap Into Oracle SQL?

Sep 24, 2012

I have MFC class that contains a CMap with 160K~ entries. CMap(long,long,long,long).

I need to save this CMap in oracle SQL.

How do you recommend to save it ?

View 1 Replies View Related

Visual C++ :: Saving Unicode Strings To Txt Files

Jan 20, 2014

In my project , we need to create an Array of Unicode Strings . The Array will contain 5000 Strings.

I need to write those strings to a text file which can be opened or edited with NotePad.

Normal _tfopen and fwrite are not able to create notepad compatible .txt file .. I mean the file I created is not readable with Notepad though file open mode is "w+t"

How can I save my unicode strings to a text file

View 6 Replies View Related

C/C++ :: How To Read And Analyze Code

Jan 21, 2014

Am I doing this correctly? My assignment is pretty much to answer certain codes manually.

int i = 0;
while (i < 7 )
{
cout << 2 * i;
++i;
}

Does this code read as

2 * 0 = 0
2 * 1 = 2
2 * 3 = 6
2 * 4 = 8
2 * 5 = 10
2 * 6 = 12

How about the ++i part?

View 5 Replies View Related

Visual C++ :: Line Graph Using Single Line Values From Bitmap

Feb 3, 2014

I was loaded a bmp file in my mfc window and stored rgb data in a file.My image size is 320x240.

Is possible to pick a single point (location) from that bmp image (Not the whole window)?

i like to plot a line graph using the pointed single line data using the stored file data?

here R is X Axis and G & B is Y Axis.

If i have 2D array of data means how can i plot the line graph?

View 4 Replies View Related

C :: Program To Analyze PNG Files To Assess Whether They Have Any Rotational Symmetry

Feb 27, 2013

I would like to write a program that can analyze png files to assess whether they have any rotational symmetry.

I am aware that opencv can be used to do certain image recognition tasks, would it be appropriate for what i'm trying to do?

This program must work in linux.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved