A defishing script for the Samyang/Falcon/Walimex (and other rebrands) to batch defish all the photos inside a folder. For Windows and Mac OS X (thanks to Brian Czapiga), with Hugin installed on it.
These scripts defish the photos using the panini method (straightens only the vertical lines) or the rectilinear method (straightens both vertical and horizontal lines).
The defishing algorithms are extracted from Magic Lantern. So if you use Magic Lantern the defished image you see in your camera is exactly the same image you will get with these scripts.
You can se these scripts in action HERE (thanks to Mars Lander).
Fisheye-Hemi is a Photoshop plug-in filter which provides correction for hemispheric fisheye lens distortion. Fisheye Hemispheric lenses in the hands of a photographer provide an expanded view of the world across approximately a 180 degree diagonal field. Fisheye-Hemi fisheye lens correction software offers an aesthetically pleasing and natural view of the image using a unique mapping technology! Can you recommand me a software for doing this job? I shoot using Sigma 8mm lens and I would like to be able to obtain a normal image out of that. What software should I use for converting fisheye photos to normal rectilinear photos? Ask Question 10. It's using a proprietary remapping that is not simple rectilinear defishing, which.
What you need
- Any Windows or Mac OS X version
- Hugin (Download here)
- My scripts (Download here)
Usage instructions
- Download and install Hugin
- Download the scripts
- Open with the notepad the batch file you want to use (defish-panini.bat/sh or defish-rectilinear.bat/sh) and in the second line after the words 'set width=' replace the numbers with the width of your images, and in the third line after the words 'set height=' replace the numbers with the height of your images
- Save the modified batch file and close the notepad
- Put the batch file in the same directory of your photos and just run it, it wil defish all the images inside the directory
Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up1 contributor
/* |
* C++ utility to convert a PPM image from circular fisheye into rectilinear projection |
*/ |
#include<stdio.h> |
#include<stdlib.h> |
#include<string.h> |
#include<math.h> |
voidchomp(char *buffer) |
{ |
char *end = strchr(buffer, '0'); |
if (end > buffer && *(end - 1) 'n') *(--end) = '0'; |
if (end > buffer && *(end - 1) 'r') *(--end) = '0'; |
} |
intmain(int argc, char *argv[]) |
{ |
char linebuf[1024]; |
// read PBM signature. |
if (!fgets(linebuf, sizeof(linebuf), stdin)) abort(); |
chomp(linebuf); |
if (strcmp(linebuf, 'P6') != 0) abort(); |
// read dimensions. |
int width, height; |
while (1) { |
if (!fgets(linebuf, sizeof(linebuf), stdin)) abort(); |
chomp(linebuf); |
if (linebuf[0] '#') continue; |
if (sscanf(linebuf, '%d %d', &width, &height) != 2) abort(); |
break; |
} |
if (width < 1 || height < 1) abort(); |
// read bitdepth. |
int bitdepth; |
while (1) { |
if (!fgets(linebuf, sizeof(linebuf), stdin)) abort(); |
chomp(linebuf); |
if (linebuf[0] '#') continue; |
if (sscanf(linebuf, '%d', &bitdepth) != 1) abort(); |
break; |
} |
if (bitdepth != 255) abort(); |
// read pixel data. |
unsignedchar *pixels[height]; |
for (int i = 0; i < height; i++) { |
pixels[i] = newunsignedchar[width * 3]; |
if (fread(pixels[i], 3, width, stdin) != (size_t) width) abort(); |
} |
// write out new image format. |
int midy = height / 2; |
int midx = width / 2; |
int maxmag = (midy > midx ? midy : midx); |
int circum = 2 * M_PI * maxmag; // c = 2*pi*r |
printf('P6n'); |
printf('%d %dn', circum, maxmag); |
printf('%dn', bitdepth); |
char black[3] = {0,0,0}; |
for (int y = 0; y < maxmag; y++) { |
for (int x = 0; x < circum; x++) { |
double theta = -1.0 * x / maxmag; // -(x * 2.0 * M_PI / width); |
double mag = maxmag - y; // y * 1.0 * maxmag / height; |
int targety = lrint(midy + mag * cos(theta)); |
int targetx = lrint(midx + mag * sin(theta)); |
if (targety < 0 || targety >= height || targetx < 0 || targetx >= width) { |
fwrite(black, 1, 3, stdout); |
} else { |
fwrite(&pixels[targety][targetx * 3], 1, 3, stdout); |
} |
} |
} |
return0; |
} |
Copy lines Copy permalink