This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (i = 0; i < LENGTH(iImage->Pixels); i++) | |
{ | |
pixel = pos = 0; | |
for (row = -(m - 1)/2.0; row <= (m - 1)/2.0; row++) | |
{ | |
for (col = -(m - 1)/2.0; col <= (m - 1)/2.0; col++) | |
{ | |
pos = i + row * iImage->Width + col; | |
if (pos >= 0 && pos <= lastPixel) // Check for top and bottom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL filter_2DConvolution(IMAGE* iImage, IMAGE* oImage, int F[3][3]) { | |
int i, row, col; // counters | |
int m = 3; | |
int normalization = 0; | |
int pixel, pos; | |
int lastPixel = iImage->Width * iImage->Height - 1; | |
printf("Filter:\n %d %d %d\n %d %d %d\n %d %d %d\n", | |
F[0][0], F[0][1], F[0][2], | |
F[1][0], F[1][1], F[1][2], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef DEBUG | |
printf("Image compression: RLE8\n"); | |
printf("Bit offset: %d\n", bmfh.BfOffBits); | |
#endif | |
i = 0; | |
while(1) { | |
fread(&pixels, sizeof(BYTE), 1, fp); | |
fread(&color, sizeof(BYTE), 1, fp); | |
if ( pixels != 0x00 ) // escape char? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef DEBUG | |
printf("Image compression: RLE8\n"); | |
printf("Bit offset: %d\n", bmfh.BfOffBits); | |
#endif | |
i = 0; | |
while(1) { | |
fread(&pixels, sizeof(BYTE), 1, fp); | |
fread(&color, sizeof(BYTE), 1, fp); | |
if ( pixels != 0x00 ) // escape char? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL bmp_open(char* file, IMAGE* image) { | |
BITMAPFILEHEADER bmfh; | |
BITMAPINFOHEADER bmih; | |
unsigned int rowSize, i, totalPixels = 0; | |
BYTE blue, green, red; | |
/* note: "rb" means open for binary read */ | |
FILE* fp = fopen(file, "rb"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#define LENGTH(x) (sizeof(x)/sizeof(*(x))) | |
//static int[] numbers = { 49, 82, 96, 21, 81, 38, 7, 79, 32, 39, 94, 74, 70, 45, 8, 25, 86, 48, 85, 14, 6, 18, 48, 76, 2, 79, 17, 68, 62, 20 }; | |
//static int[] numbers = { 7678, 3701, 2012, 7339, 6890, 1413, 2878, 3109, 2520, 579, 5047, 1562, 2986, 7638, 5555 }; | |
//static int[] numbers = { 3, 1, 4, 3 }; | |
typedef struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Number : IComparable | |
{ | |
public Number num1; | |
public int num2; | |
public int base1; | |
public int base2; | |
public int val; | |
public Number(Number num1, int num2) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* @author Matthias | |
*/ | |
abstract class Scraper | |
{ | |
// Name of the scraper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Some methods might fail due to pcre.backtrack_limit when using preg_match_all | |
*/ | |
class Scraper_Imdb extends Scraper | |
{ | |
protected $_urls = array( | |
'main' => 'http://www.imdb.com/title/%s/combined', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Controller_Base **/ | |
public function set_pagination($url, $segment, $total_items, $per_page = 20) | |
{ | |
Pagination::set_config(array( | |
'pagination_url' => $url, | |
'uri_segment' => $segment, | |
'total_items' => $total_items, | |
'per_page' => $per_page, | |
'template' => array( | |
'wrapper_start' => '<ul class="pager">', |
OlderNewer