bicubic

Bi-Cubic Interpolation Algorithm for Image Scaling

微笑、不失礼 提交于 2020-01-12 03:21:31
问题 I'm trying to write a basic bicubic resize algorithm to resize a 24-bit RGB bitmap. I have a general understanding of the math involved, and I'm using this implementation from Google Code as a guide. I'm not using any external libraries here - I'm just experimenting with the algorithm itself. The bitmap is represented as a plain std::vector<unsigned char> : inline unsigned char getpixel(const std::vector<unsigned char>& in, std::size_t src_width, std::size_t src_height, unsigned x, unsigned y

Bicubic Interpolation?

让人想犯罪 __ 提交于 2020-01-10 20:02:11
问题 I looked through the internet, and in terms of Bicubic Interpolation, I can't find a simple equation for it. Wikipedia's page on the subject wasn't very helpful, so is there any easy method to learning how Bicubic Interpolation works and how to implement it? I'm using it to generate Perlin Noise, but using bilinear interpolation is way to choppy for my needs (I already tried it). If anyone can point me in the right direction by either a good website or just an answer, I would greatly

Bicubic interpolation in C

心已入冬 提交于 2019-12-24 01:38:26
问题 im trying to deal with the bicubic image interpolation in c . Therefore i've built this small script. 1. the "resize_image"-function: void resize_image(PPMImage *source_image, PPMImage *destination_image, float scale) { uint8_t sample[3]; int y, x; destination_image->x = (long)((float)(source_image->x)*scale); destination_image->y = (long)((float)(source_image->y)*scale); for (y = 0; y < destination_image->y; y++) { float v = (float)y / (float)(destination_image->y - 1); for (x = 0; x <

Implementation of Bi-Cubic resize

懵懂的女人 提交于 2019-12-22 09:47:00
问题 I've been attempting to code a Bi-Cubic resize algorithm for in-memory bitmaps. I'm familiar with how bi-cubic interpolation works, and I've used both the Wikipedia article and existing implementations as a guide towards coding my own version. The following is my simple implementation. Here, bmap is a vector containing the bitmap data, and get_subpixel is simply a function that treats the bitmap as a 3D array composed of X x Y x Channel pixels, and returns a single sub-pixel at the specified

Cubic/Curve Smooth Interpolation in C# [closed]

淺唱寂寞╮ 提交于 2019-12-20 19:37:52
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Below is a cubic interpolation function: public float Smooth(float start, float end, float amount) { // Clamp to 0-1; amount = (amount > 1f) ? 1f : amount; amount = (amount < 0f) ? 0f : amount; // Cubicly adjust the amount value. amount = (amount * amount) * (3f - (2f * amount)); return (start + ((end - start) *

GLSL performance - function return value/type

白昼怎懂夜的黑 提交于 2019-12-11 16:24:49
问题 I'm using bicubic filtering to smoothen my heightmap, I implemented it in GLSL: Bicubic interpolation: (see interpolate() function bellow) float interpolateBicubic(sampler2D tex, vec2 t) { vec2 offBot = vec2(0,-1); vec2 offTop = vec2(0,1); vec2 offRight = vec2(1,0); vec2 offLeft = vec2(-1,0); vec2 f = fract(t.xy * 1025); vec2 bot0 = (floor(t.xy * 1025)+offBot+offLeft)/1025; vec2 bot1 = (floor(t.xy * 1025)+offBot)/1025; vec2 bot2 = (floor(t.xy * 1025)+offBot+offRight)/1025; vec2 bot3 = (floor

Bicubic Interpolation on Scattered Data in Matlab

巧了我就是萌 提交于 2019-12-07 14:29:58
问题 I was wondering if there is a way to do bicubic interpolation on a scattered data set (2d)? I did some online searches and figured out that bicubic patches (not sure what these are) need to be fitted on scattered data. Not sure how to proceed from here. Any help will be appreciated! Note: I understand that Matlab recommends TriScatteredInterp and griddata to interpolate on scattered points. However, TriScatteredInterp is a triangulation interpolation and does not uses splines to interpolate

Java 2D Image resize ignoring bicubic/bilinear interpolation rendering hints (OS X + linux)

女生的网名这么多〃 提交于 2019-12-07 11:30:28
问题 I'm trying to create thumbnails for uploaded images in a JRuby/Rails app using the Image Voodoo plugin - the problem is the resized thumbnails look like... ass. It seems that the code to generate the thumbnails is absolutely doing everything correctly to set the interpolation rendering hint to "bicubic", but it isn't honoring them on our dev environment (OS X), or on the production web server (Linux). I've extracted out the code to generate the thumbnails, rewritten it as a straight Java app

Bicubic Interpolation on Scattered Data in Matlab

对着背影说爱祢 提交于 2019-12-05 22:05:03
I was wondering if there is a way to do bicubic interpolation on a scattered data set (2d)? I did some online searches and figured out that bicubic patches (not sure what these are) need to be fitted on scattered data. Not sure how to proceed from here. Any help will be appreciated! Note: I understand that Matlab recommends TriScatteredInterp and griddata to interpolate on scattered points. However, TriScatteredInterp is a triangulation interpolation and does not uses splines to interpolate the data. The data which I have looks something like this (x, y, val): x = [0 0 0 0 0.28 0.28 0.28 0.28

Implementation of Bi-Cubic resize

青春壹個敷衍的年華 提交于 2019-12-05 21:46:58
I've been attempting to code a Bi-Cubic resize algorithm for in-memory bitmaps. I'm familiar with how bi-cubic interpolation works, and I've used both the Wikipedia article and existing implementations as a guide towards coding my own version. The following is my simple implementation. Here, bmap is a vector containing the bitmap data, and get_subpixel is simply a function that treats the bitmap as a 3D array composed of X x Y x Channel pixels, and returns a single sub-pixel at the specified coordinates. std::vector<unsigned char> bicubic_resize( std::vector<unsigned char>& bmap, std::size_t