All Questions
592 questions
1
vote
0
answers
61
views
cs50 filter-more blur passes all test except 4x4 test
Sorry in advance. English is not my first language and this is my first question... Might not follow correct format.
I am trying to solve the CS50 filter-more problem with box blur method. I have to ...
1
vote
1
answer
57
views
Edge function in cs50 filters pset
I’ve been working on the cs50 filters assignment. All the other ones have had pretty small issues with easy fixes, but this one if completely not working.
This project’s intended purpose is to detect “...
0
votes
1
answer
146
views
Reduce an Image in C
Hello fellow programmers. I'm new to the forum so please bear with me.
What I am trying to achieve is taking a loaded image from file(e.g. background wallpaper image 4000x2250) and scale it down to ...
0
votes
1
answer
108
views
Why is Fread, Only Working with Certain Files?
I've starting tinkering around with the Fread/Fwrite functions within C. I'm basically working on a program that manipulates data on a CSV file for my month end accounting task. For my CSV files, ...
1
vote
1
answer
64
views
Issue with Rendering Images in C HTTP Server
I've been working on a project where I'm implementing an HTTP server in C, and I'm encountering an issue with rendering images in a web browser. Every time I try to access the image via the server, I ...
0
votes
0
answers
50
views
reflect and blur image filter not working
hi my image filter does not work for reflect and blur please can you help me find the solution
the reflect function reflects the image horizontally
the blur function blurs the image
When i pass images ...
1
vote
0
answers
56
views
Reading data from BMP
I have a problem with reading pixels from bmp file. I don't know what's causing the problem. It might be something with padding at the end of row or fseek(). I share important parts of program.
bmp.c
...
1
vote
0
answers
47
views
My function for read_BMP_header don`t work on valid width ana height check
Here is text of check: "Given the valid BMP stream When the function is invoked Then the image width must be valid And the image height must be valid"
Here is file bmp.h
#ifndef _BMP_H
#...
1
vote
1
answer
57
views
Read bmp header
here is my structure for header of BMP file
#ifndef _BMP_H
#define _BMP_H
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#define PADDING_CHAR "\0"
/**
* ...
1
vote
1
answer
46
views
Creating a Checkerboard in a .ppm File Only Works for Specific Tile Dimensions
I'm trying to write a C program to generate a .ppm image file, of given length and height, that looks like a rectangular checkerboard pattern, consisting of tiles of a given length and height, and ...
0
votes
1
answer
46
views
Select specific pixels of an image
I'm using C and stb_image, and image data is stored in an unsigned char* where a group of 4 elements represents a pixel, with r, g, b, and a channels respectively. I'm trying to get pixels of part of ...
1
vote
1
answer
88
views
Read and write BMP image (grayscale)
I have this code to read bmp image and then write it in new image. The problem that I faced is that the resulting image from write_bmp function give the same size of the original reading image but I ...
1
vote
4
answers
258
views
Do I lose quality if I decompress a JPEG file into a ppm using libjpeg-turbo C library?
I was trying to turn a jpg photo into a pixel map. I discovered that I can do it with the C library libjpeg-turbo by transforming the jpg photo into ppm. With djpeg jpegfile.jpg imagefile.ppn.
Does ...
1
vote
1
answer
131
views
Tk_PhotoPutBlock does not render my svg file correctly
I'm trying to implement this example written in C with C Tk API.
My objective is to try to use this library to transform an svg file into a photo Tk to be read in frame Tk. Below is my svg file :
<...
2
votes
0
answers
99
views
Having trouble determining source of image corruption when converting subsampled blue and red chrominance back to RGB
Update: Solved issue. My YCbCr to RGB function did not first check for arithmetic over and underflow. Thanks to everyone who replied! I'll leave the problematic code and add my solution in case ...
1
vote
1
answer
186
views
C Function to create BMP file header from width and height
I need help filling out a BMP file based on the width and height of an image.
What I am working with:
struct BMP_Header {
char signature[2];
int size;
short reserved1;
short ...
1
vote
0
answers
50
views
How do I navigate a structure array and also read/write to it?
I have tried fread((*pArr)[i][j], sizeof(struct Pixel), 1, file); and also tried using pointer arithmetic to the best of my understanding but I have been unsuccessful in implementing my writePixelsBMP ...
0
votes
0
answers
44
views
CS50 PSET4 Filter Blur Black Photo
When I run the program it outputs a black picture for some reason. The goal is to use box blur effect and get all the RGB values for all pixels within 1 row and column and find the average
For ...
0
votes
0
answers
52
views
Is it possible to display an image on the Windows console using the C programming lenguage?
Want to know if it's any possible way to do it. I've been doing console programs since I started coding in C, and now this question has come to my head. I don't think it's possible. Any help will be ...
0
votes
1
answer
64
views
My CS50 code for Edges (pset4) returns just a black screen
That's my current code, which is now returning a major white image.
I added a temp variable to store the changes in the image and attached it to pixel_with_edges. This one I passed to the new image[...
1
vote
3
answers
114
views
My code prints a hex that is not valid for an image, it's not a value from the array that I am comparing. I don't understand where is coming from
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
// open image
FILE *image = fopen("me.jpg", "r");
// read image
// check ...
0
votes
0
answers
734
views
Decoding JPEG image using C
I have been experimenting with writing a C program to decode a JPEG image, with help from the following website that does the same in Python:
https://yasoob.me/posts/understanding-and-writing-jpeg-...
1
vote
0
answers
1k
views
How to use TETRAHEDRAL INTERPOLATION in 3d LUT?
I am make some practice in the image processing.
I try the trilinear interpolation and tetrahedral interpolation in 3DLUT image style transformation.
According to some papers, the image quality of ...
1
vote
1
answer
93
views
Color BMP image converted with mean filter results in skewing while others are successful
Excuse me, I'm working on my computer course assignment, which is about image filtering with mean filter. It is required not to use external libraries of C++ and C language, but now it has encountered ...
1
vote
1
answer
111
views
C. Problem reading in the pixels of a BMP image
I am trying to read in the pixels of a BMP image with the code below. First I read in the relevant image data (width, height and header) using my function "readBMPHeader". Next I want to ...
0
votes
0
answers
57
views
C: Problem with Reading a .txt file into a 2D array
I am trying to read an Ascii-image given as a txt-file, called "ascii_image.txt", into a 2D character array. I am using function called "getAsciiImageDimension" to obtain the "...
2
votes
2
answers
469
views
How to handle padding when reading in a BMP?
I am trying to read in a BMP file using C and to generate a grayscale version of that image. However, I do not know how to handle the padding of rows. (Recall that the size of each row in bytes has ...
1
vote
1
answer
82
views
Why is no data getting written to image?
I'm trying to create procedural textures, and for that, I'm generating noise, and then writing that data to an image file, to be displayed. So far I generated the noise, and now I'm trying to write ...
0
votes
1
answer
104
views
White image saved with stbi_write_bmp has black columns. Why?
I created a white image with this code:
#include "stb_image/stb_image.h"
#include "stb_image/stb_image_write.h"
int main(void){
int width = 1440;
int height = 1080;
...
0
votes
1
answer
163
views
memcpy argument memory ranges overlap when using MPI gather
I am trying to do image convolution in C using mpi. My idea is to divide the image into different chunks and let different process do different rank, and then gather them in a root process.
I am quite ...
0
votes
2
answers
100
views
Getting image rendering errors while sending it through C code using fread and send functions over tcp socket in a http response
I am writing a simple web server as a personal project in c. The server can take in a static files path and then serve those static files. The approach I am using is working well for any text/* ...
0
votes
1
answer
89
views
Blur filter in C results in only a slightly changed image
i am trying to make a blur filter in c that takes the neighboring pixels of the main pixel, takes the avarage of the rgb values and stores it in the temp array, them changes the image using the temp ...
-1
votes
1
answer
53
views
So, this function was supposed to use edge detection and apply sobel filter. But well It doesn't
I'm trying to figure out what I did wrong. My intent is in title :)
This is the code I tried, and it clearly isn't working. It just print's 1 solid colour, also edges are not included yet. What part ...
0
votes
0
answers
179
views
FFMPEG and STB_Image Create awful Picture
I was learning how to use the FFMPEG C api and I was trying to encode a jpeg into a MPEG file. I load the JPEG into (unsigned char *) using the stb-image library. Then I create a (uint8_t *) and copy ...
0
votes
1
answer
59
views
Segmentation Fault while reading a file and trying to print the information
I writing a C code to read a .txt file, however I keep having this segmantation fault and I can't figure out what is going on, Could i please use some help?
Here's the code. More information below.
#...
0
votes
1
answer
78
views
Exception thrown: write access violation. Variable was nullptr
I have to read a .pgm file for an assignment and decode the least significant bit in every byte to get some hidden text. I have the reading and writing code from the professor but when I try to read ...
0
votes
0
answers
142
views
CS50 recover Pset4 does not pass check50
This program is designed to recover images from a digital camera SD card. The program is not passing the last three checks when I run it through check50. The program does not recover 000.jpg, middle ...
0
votes
1
answer
235
views
Can't read and write bmp
Hy I wanted to read a bmp file into a struct and write it then back but the image is alway black the header is ok. but the pixels get wrong written. I compared the hex values and they are the same ...
2
votes
1
answer
3k
views
cs50 week4 filter(less comfortable) blur and sepia function
#include "helpers.h"
#include "math.h"
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
for (int i = 0; i < height; i++)...
-1
votes
1
answer
743
views
Image operation using c language
I want to add two images using c programming language. If the dimension of the images is 600*600, then from the 1st image, 1 to 300 pixels will be there in the new image and 300 to 600 pixel of the ...
2
votes
2
answers
84
views
Can you assign values to all elements in struct for a 2D array in C?
I want to make a grayscale filter so I have to assign the average of all 3 RGB values to each. I use a 2D array because this is a bitmap image and I'm filtering it by changing each pixel.
This is how ...
0
votes
1
answer
134
views
problems with buffer overflow with images in c
there! I saw a Youtube video, that was using C++ to create images. I decided to port it to C & it works like a charm. The tutorial teaches how to work with ppm files.
So then, I decided to turn it ...
1
vote
1
answer
661
views
CS50 recover.c Need explanation on file creation
I watched the solution online and one detail didn't appear clear to me,Which specific command line does the job of creating the jpg files?
I suppose nothing else other than sprintf could do that, but ...
-1
votes
1
answer
97
views
Blur image function causing segfault in C
I am receiving a Segmentation fault (core dumped) error when trying to blur an image, but I cannot find out why. To achieve a blur, I loop through each element in the 2x2 image array. I then check ...
0
votes
1
answer
91
views
Is it necessary to do all arithmetic operations for filtering images in one line for C? for CS50 filter-less
I've been doing the "filter-less" problem for CS50 and noticed that, this code:
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
for (int i = 0; i < height; i++)...
0
votes
0
answers
97
views
Trying to copy an BMP image
I'm trying to make a BMP image copy but the image is still breaking and I have no idea what's going on. I need help to solve this problem. After the copy was made, i'll try to do a Steganography by ...
1
vote
1
answer
57
views
Trying to blurr an image in C but whole row is blured same way
So I am trying to make a function that blurs an image, basically checks all pixels around it by 1 if there is adds to counter and divides total RGB and for some reason my picture comes out like this: ...
0
votes
2
answers
46
views
Getting a segmentation fault at certain moment
I tried to apply box blur to an image (without a matrix but just iterating over 9 neighbooring pixels) but I am always getting a segmentation fault after I get to 408th pixel of an image (on the 1st ...
1
vote
1
answer
407
views
Encoding QR data as PNG using C and stb_image_write
im trying to render QR to image (png, svg) using QR-Code-generator-1.8.0 and stb_image_write, i follow the example
on demo example and generate the QR correctly but very small and i dont know how to ...
0
votes
0
answers
10
views
Intended behavior with segfault or illegal hardware instrution in C program [duplicate]
The program below is intended to output random noise as a .pbm. The program works perfectly with a height and width < 500. But with a size of 1000 it segfaults yet still generates the image.
#...