Though it still crashes even if I change it to i-qi
Type: Posts; User: DGB_684
Though it still crashes even if I change it to i-qi
Well it appears to run fine when I break before the first if statement but for ((RGBArray[i+qi][j+qj].red != QueryArray[qi][qj].red) || (RGBArray[i+qi][j+qj].green != QueryArray[qi][qj].green ||...
I have this code to try and locate a small array within a big array but it seems to crash on the first if statement. Both arrays are dynamically allocated from files and point to a strcuture.
...
Solved it! It was just a pointer mistake. This code I sent was fine.
I've been trying to add two 2D arrays together with different element types: red, green and blue that point to a structure. I'm pretty sure the two arrays are read in correctly I just don't think...
So I've declared two arrays like this (red, green and blue are in a structure and the head pointer is just used to locate which file I'm looking at):
int i, j, qi, qj, identify_x, identify_y;
...
Though I believe the for loops in the code are at least correct.
Well if I'm stuck I generally look it up and repurpose found code to better understand it so I can do it myself.
I've tried this based on another post I've found on this subject. Where head[1].height/width is for the big array and head[2].height/width is for the smaller (query) array. i and j are width and...
I've got two 2D arrays declared and I want to write some code to find the smaller one within the bigger one. Any tips on how this could work? I know it involves something like looping the values of...
So far this is what I've got:
What I'm trying to do is read in a PPM, store it in an array (done), then prompt the user to enter a threshold. Then detect the edges in an image and output to a new...
I've made your suggested changes and it works now! Thanks a lot! The array doesn't look all that pretty but it works fine now!
This is one part of a larger piece of code. In the main code is ~350 lines of code plus and I used functions in there. That's also why I have so many variables. Yes it is confusing but I can't really...
Oh ok I overlooked that one thanks. The other errors still persist unfortunately...
So my code involves reading in a PPM image and then storing it in an array so it can be saved in an new ppm file. Though I think there is a problem with my pointers that means its not actually...
I changed it to this but I still don't think its right. The point of this program is to read in (pixel) values from a ppm file, store them in an array and then write them into a file. So I want the...
typedef struct
{
int rgb_comp_colour;
char buff[16];
char filetype[2];
int height;
int width;
} PPMHead;
Ohhhh. I see. How would I initialise it? Is it similar to initialising a pointer?
I've been trying for ages to get this code to work but it just presents me with a blank file every time. Any help is very much appreciated.
#include <stdio.h>
#include <stdlib.h>
#include...
What is happening there? I never got any of those?
I think that is an accident. The malloc should be in the for loop. Yes I guess image processing not everyone is familiar with which is why I've found it so hard to get help on this. Its more to do...
Cool. Thanks. Here is the updated code. But the errors were mostly minor so not much has really changed.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define maxheight 1080
Ok. I think I managed it. But I still have the three original errors popping up despite resolving the rest.
Great. Thanks. Would you have any idea how to do that in visual studio code?
Its quite long but this is all my code.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define maxheight 1080