C :: Generating Histogram Of PGM Format Image

Jul 29, 2014

I need a C code for generating a Histogram with intensities at X-axis and number of pixels at Y-axis from a PGM format image.

View 5 Replies


ADVERTISEMENT

C :: Calculate Equalized Histogram Of Grayscale Image

May 14, 2013

I have an assignment on image processing and amongst other question one of them specifies:calculate the equalized histogram of a grayscale image and show statistical data of your choice between the input and output images.

I am having trouble equalizing the histogram. Either I am missing the whole picture or minor details that cause problems.

Code:

// original histogram
for (i=0; i<lines; i++)
for (j=0; j<columns; j++)
hist[image_in[i][j]]++;
//histogram max and min
int hmax=-1,hmin=257;
for(int i=0;i<256;i++) {

[Code]...

I am thinking that my equalization formula is wrong, i might have incorrectly translated the mathematical formula from wikipedia to C code but i cant figure out why.

View 9 Replies View Related

C :: Editing Image In PPM Format

Mar 10, 2014

I'm trying to edit an image by multiplying the red component of each pixel by 10 and leaving the other components (green and blue) untouched. I'm not really sure how I'm supposed to edit the pixels one by one. I have this so far. I think there is something wrong with my ppm header as well. Is there a way to make a ppm header without specifying the bounds so that it conforms to the image you are putting in?

Code:

#include <stdlib.h>
#include <stdio.h>
#define PICTURE_FILE 1
#define MIN_ARGS 2
#define h 768
#define w 1024
void solve(FILE *in_picture, FILE *out_picture)

[Code] .....

View 6 Replies View Related

C++ :: How To Take Screenshot And Save It In Image Format

Jul 31, 2014

I want to take screen shot and save it in any image format like jpg, bmp, ppm or any other .

View 3 Replies View Related

C/C++ :: How To Save Entire Web Page As Image (JPEG Format)

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

C :: Borders Around Histogram

Mar 6, 2015

I'm able to get the graph, but now getting the border on the other side of the graph to align it with the right side of my screen.The output looks like that right now because I'm currently playing around with my y axis (right under the for loop) trying to scale everything. I've tried everything many different ways to get this to work.getting the border on the other side of the graph.

Code:

#include<stdio.h>
#include<Windows.h>
int main(void) {
int MAX = 0; //initialize and declare variables
int allcounts [10] = {0}; //store an array of integers for
}

[code]...

View 4 Replies View Related

C# :: Compare The Image Of A Button To Another Image In Visual Studio

Jul 3, 2014

Im trying to compare the image of a button to another image in Visual Studio like so...

//variables
Image active = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\active.png");
Image stunned = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\stunned.png");

[Code]...

btnStatusPlr1.Image SHOULD come back as True.Then I realized it might not be the same as setting the buttons image in the properties (Which is what i did to get the original image (the one being compared to))

I do have a feeling ive done something wrong here (Yes im a noob /> )

Variable active, is the same image as the buttons default (Well should be)

View 1 Replies View Related

Visual C++ :: Histogram With Bin Size 5

Mar 15, 2013

I have following code to create histogram, but it gave wrong output. In the program input_vector read 100 double numbers. I want to create a histogram with bin size=5. Output is [0;0;0;0;0].

Code:
vector<double>three_dimensional_shape_retreival_Hough_Transform:: histogram_creation(vector<double> input_vector) {

long int i;
long int j;

Mat histogram_input(input_vector);
cout<<"Histogram Input Matrix:"<<histogram_input<<endl;
int histSize =5;

[Code] .....

View 4 Replies View Related

C :: Printing Histogram About Number Frequencies?

Mar 6, 2015

have this program .. i tried to make it work to give me this result output:

Code:
input array {1,3,5,1,1,8,6,6,1,3,2,1,6,8,8}
[0]
[1] *****
[2]*

[Code].....

instead i'm having asterisks at the end of the output

View 14 Replies View Related

C :: Implementation Of Histogram Using Functions And Arrays

Apr 12, 2013

I'm trying to code one of the problems but it really is hard to catch errors for a novice like me at first.

I have to Write a single C function for computing the histogram of a list of nonnegative integers into 4 bins.

The main() function first initializes a positive integer array called List of size N, takes 3 inputs from the user A, B, C (assume 0 < A < B < C), and declares a second integer array Bin[4].

The doBinning function should count the number of elements of List in the interval [0, A) and store it in Bin[0], count of [A, B) in Bin[1], count of elements in [B,C) in Bin[2], and the number of elements >= C in Bin[3]

Code:
#include <stdio.h>
#define N 10
#define M 4
int *doBinning (int source[], int dest[], int a, int b, int c);
int main (){

[Code] ....

Somehow I keep getting error from ptr = doBinning(List[], Bins[]. What am I doing wrong? Code might contain some errors.

View 3 Replies View Related

C :: Scaling Y Axis - Vertical Histogram

Mar 6, 2015

Scaling the yaxis on my histogram for one of my class projects. I've gotten mostly everything but stuck on scaling. I'm pretty sure it's something simple to do, but I'm having trouble, and I've tried everything to my knowledge to get it scaled from 0.1 - 1, like this:

Here is my code:

#include<stdio.h> //include all preprocessor directives
#include<Windows.h>
int main(void) {
int MAX = 0; //initialize and declare variables
int allcounts [10] = {0}; //store an array of integers for
int yaxis, xaxis = 0;

[Code] ....

I'm close, but every time I try and change my y axis in the for loop from 1 going down to 0.1, it doesn't give me a right output.

View 2 Replies View Related

C++ :: How To Create Histogram From A Set Of Values In OpenCV

Mar 9, 2013

I have a text file which consist of several values. These values represent distance from origin to any point in the triangle. How can I create histogram from these values? Is there any functions in OpenCV which can create histogram from these values?

Below my sample values are given:
..........................
3.4 1.2 6.9 0.2 5.1 2.9
........................

View 2 Replies View Related

C :: Normal Distribution Histogram - Random Numbers

Feb 6, 2013

Write a function that generates 1000 normally distributed (Gaussian Probability Distribution) random numbers. Range should be between -3 and +3. Numbers should be double floating point.

There's more to it than that, but I've got it from there.

View 7 Replies View Related

Visual C++ :: Create Histogram From A Set Of Values In OpenCV?

Mar 9, 2013

I have a text file which consist of several values. These values represent distance from origin to any point in the triangle. How can I create histogram from these values? Is there any functions in OpenCV which can create histogram from these values? Below my sample values are given:

..........................

3.4 1.2 6.9 0.2 5.1 2.9

........................

View 1 Replies View Related

C :: Doing Histogram Using Pthreads - Segmentation Fault (core Dumped)

Apr 24, 2014

I am doing Histogram using pthreads and after long struggle on it.. finally it says 'Segmentation Fault (Core Dumped)'. I knew that error means something somewhere I am accessing to a wrong memory location.

Here is my code..

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void Usage(char prog_name[]);
void Gen_data(void *p);
void Gen_bins(void *p);
int Which_bin(void *p);
void Print_histo(void *p);

[Code] ...

How to fix 'Segmentation Fault (Core Dumped)'?

View 2 Replies View Related

C :: Display Histogram Of 1000 Gaussian Distributed Numbers

Mar 5, 2013

I'm writing a program to display a histogram of 1000 Gaussian distributed numbers. I've generated the numbers using rand and now need to transform them. I have found the following formula to use

f(x) = exp(-x^2 / (2*sigma^2)) / sqrt(2*pi*sigma)

And I am unsure how to implement this into a function.

View 3 Replies View Related

C :: Testing Random Numbers And Prepare Histogram With Each Number

Dec 30, 2013

I have to make program which can generate a lot of random numbers and than prepare histogram with each number. Histogram must look that:

0 ( 50):*****************************************
1 ( 59):********************************************** ***
2 ( 42):***********************************
3 ( 49):****************************************
4 ( 41):**********************************
5 ( 53):********************************************
6 ( 60):********************************************** ****
7 ( 47):***************************************
8 ( 54):*********************************************
9 ( 45):*************************************

View 14 Replies View Related

C++ ::  Vertical Histogram - Variables In For Loop To Print Stars

Dec 6, 2013

I want to create a vertical histogram in my code. I already made it go vertical but not the way I want it.

Example:
I want it like this:

Range1 Range2 Range3 Range4

And asterisks under each one, depending on the user input. (My code is below and doing it on here doesn't make it come out correctly)

But what I've managed to do is this:

Range1
*
*
*

Range2
*
*

Range3
*
*
*
*

Range4
*
*

Which I don't want. I want everything else to stay pretty much the same since I can only use some features such as Arrays and really basic functions.

Here is my code: (Worked fine last time I used it and I am doing it on Visual Studio 2010 (at uni) and 2013 (on my laptop)).

#include <iostream> //Start of code
using namespace std;
int MarkValueInput; //Mark entered by user
//Counter variables for ranges in While Loop
int counterlow; //Counter for low range
int countermidlow; //Counter for mid-low range
int countermidhigh; //Counter for mid-high range
int counterhigh; //Counter for high range

[Code] .....

View 4 Replies View Related

C/C++ :: Program To Print Histogram Of Lengths Of Words In Its Input

Mar 4, 2014

Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging.

See [URL] ....

I'm trying to do this exercise from K&R on my own (with my own code), but I'm receiving a signal (Illegal instruction (Core dumped)) when the input is too large.

#include <stdio.h>
#define MAXWORDLENGTH 10
int main(void) {
int c; /* Character read */
long length[MAXWORDLENGTH + 1];
int reading_word = 0;
int word_size = 0;

[Code] ....

Where the problem might be occurring. I tried debugging with GDB but found no useful information.

Program received signal SIGILL, Illegal instruction.
0x00007ffff7a3b76e in __libc_start_main (main=0x4005d4 <main>, argc=1,
ubp_av=0x7fffffffe2a9, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffe298) at libc-start.c:258
258libc-start.c: No such file or directory.

The program output is also wrong when tested with the code provided at the link given above.

View 7 Replies View Related

C# :: Histogram - Identify Integer In Array And Insert Symbol For Every Single One

Apr 18, 2015

I am supposed to make a histogram. I succeeded in generating the integers for the histogram. But what I want to do is instead of displaying numbers in the console, I want something like "*" displayed for every integer there is in an array. It should look something like this.

*
****
*****
********
**********
******
****
***
*

As far as I understand, in some way I need to identify the integer in the array and for every single one of them I need to insert the symbol. I don't know how to identify it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1{
class Program {
static void Main(string[] args) {
diceHistogram();

[Code] .....

View 2 Replies View Related

C++ :: Program That Count Occurrence Of Character In Text File And Produce Histogram

Nov 18, 2014

Here is what i have so far:

#include<fstream>
#include<iostream>
#include<string>

[Code].....

I also need to do a loop that scan the count array and check if the element is bigger than the previous one.

View 1 Replies View Related

C++ :: Program For Generating Subsets

Mar 9, 2013

I have this program for generating subsets, I need to run it with input n=23. It has been running for the past 5 hours, is it normal???

Code:
/*generate subsets */
int subsets(vector < bool > sub, int i)
{

if (i > n) {
return 0;

[Code] .....

View 2 Replies View Related

C :: Generating Random Numbers

Oct 19, 2014

I have a program that generates random numbers. After the random number is generated, the program asks if you want to generate another random number. However, if you generate another random number, it is always the same as the first random number. How can I fix this?

View 5 Replies View Related

C++ :: Generating Big Random Numbers In C

Feb 16, 2013

I want to generate big random numbers in C(not C++ please).By "big" I mean integers much bigger than srand(time(NULL)) and rand() functions' limit(32767).

I tried writing: (note:I am not able to see "code" tag button in this editor,so I am not using it)

//****
int randomnumber;
srand( time(NULL) );
randomnumber = (( rand() % 33 ) * ( rand() % 33 ) * ( rand() % 33) * ( rand() * 33) * (rand() % 33 )) + 1
//****

But I have doubts about it's randomness quality.Also there is another problem,the program can't know the maximum random number it should use before user input,so maximum random number may need to use much smaller maximum random number according to user input.

Is there a better algorithm to create big random numbers in C?

View 2 Replies View Related

C++ :: Generating Random Integers?

Jun 9, 2013

I'm creating a game in C++ and need to generate random numbers. I know about

int main()
{
srand(time(NULL)); //Initialises randomiser or sum' like that
int x=rand%10; //Generates from 0-9
cout<<x;
}

Now, I need the best way to generate random numbers. Do I call "srand(time(NULL));" every time I want to randomise? What is the best method to generate a nearly perfect random number?

I may need to call a randomiser more than once a second, so taking second as seed (I believe that's what srand(time(NULL)); does).

View 3 Replies View Related

C++ :: Generating Big Random Numbers In C

Feb 15, 2013

I want to generate big random numbers in C(not C++).By "big" I mean integers much bigger than srand(time(NULL)) and rand() functions' limit(32767).

I tried writing: (note:I am not able to see "code" tag button in this editor,so I am not using it)

//****
int randomnumber;
srand( time(NULL) );
randomnumber = (( rand() % 33 ) * ( rand() % 33 ) * ( rand() % 33) * ( rand() * 33) * (rand() % 33 )) + 1
//****

But I have doubts about it's randomness quality.Also there is another problem,the program can't know the maximum random number it should use before user input,so maximum random number may need to use much smaller maximum random number according to user input.

Is there a better algorithm to create quality big random numbers in C?

View 14 Replies View Related







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