我得到了一个jpeg图像,其中1020x780,我试图将其调整为111x85(这是比例),但它出现像素化.
我只是尝试过
a)将图像分配给TImage组件并设置Scaled/Resize属性.
b)这里的调整大小代码http://www.delphigroups.info/2/4/313095.html
c)这里的调整大小代码http://www.swissdelphicenter.ch/torry/showcode.php?id=1896
然而,他们都出现像素化.
如果我在Photoshop中调整大小,那就好了.获得好处将是理想的,但是我知道他们花了很多时间/代码来调整大小,所以甚至中间的东西也会很棒.
有什么建议?
我想找到相似的blob(几乎相同的大小和在同一条线上). 这是一个示例图像.
我正在使用c#和opencv.
我是android的初学者.我想将位图图像分成块,然后以相同的方式显示图像但是分割.
编辑:
这段代码对我有用
Bitmap.createBitmap(位图源,int x,int y,int width,int height)
我需要找出两幅图像的峰值信噪比(PSNR).我用两种不同的方式编写代码.答案出来了.
% Read the image
I1 = imread('Image1.bmp');
I2 = imread('Image2.bmp');
Run Code Online (Sandbox Code Playgroud)
方法1
P = 255;
MSE =0;
MSE = mean((I1(:)-I2(:)).^2);
PSNR = 10*log10(P^2/MSE);
Run Code Online (Sandbox Code Playgroud)
方法2
I3 = 0;
for i=1:512
for j=1:512
I3 = I3 + (I1(i,j)-I2(i,j))^2;
end
end
Sum = mean(I3);
Sum1 = 255^2/Sum;
PSNR = 10*log10(Sum1);
Run Code Online (Sandbox Code Playgroud)
对于方法1,我的值为30.1131,对于方法2,我得到的值为24.0654.我不确定为什么值不同.需要一些帮助.
#include "iostream"
#include "cv.h"
#include "highgui.h"
#include "cvaux.h"
#include "cxmisc.h"
#include "math.h"
using namespace cv;
using namespace std;
int main(){
int height, width, x, y, i, minX, minY, maxX, maxY;
char imgFileName[100];
IplImage *origImage = cvLoadImage("BaybayinMark/b9.jpg", -1);
height = origImage->height;
width = origImage->width;
IplImage *grayImage = cvCreateImage(cvSize(width, height), 8, 1);
IplImage *binImage = cvCreateImage(cvSize(width, height), 8, 1);
//Pre-processing phase
cvCvtColor(origImage, grayImage, CV_BGR2GRAY);
cvDilate(grayImage, grayImage, NULL, 1);
cvSmooth(grayImage, grayImage, CV_GAUSSIAN, 21, 21, 0, 0);
cvThreshold(grayImage, binImage, 120, 255, CV_THRESH_BINARY);
cvNormalize(binImage,binImage,0,1,CV_MINMAX);
minX …Run Code Online (Sandbox Code Playgroud) 我试图找到物体的质心.我已经实现了连接组件标签,我已经为质心开发了以下代码,它确实给出了结果但没有给出正确的结果:我有以下输出矩阵,即matrix_img:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0
2 2 2 2 0 0 0 0 0 1 1 1 1 1 1 …Run Code Online (Sandbox Code Playgroud) 我正在使用ios5 sdk搜索图像过滤器,但我有两个问题:
对于Mac Os X,似乎有许多IOS SDK中没有的过滤器.是否可以实施它们或已经实施了它们?
是否有一个开源库,其中包含Instragram使用的过滤器?
谢谢!
我正在处理视频中的帧并实时显示(实时).算法很快,但我想知道是否有任何我可以做的优化会使它更加无缝.我不知道我的算法中的哪些函数占用了大部分时间,我的猜测是sqrt()函数,因为它显然有一些查找,但我不确定.
这是我的算法:
IplImage *videoFrame = cvCreateImage(cvSize(bufferWidth, bufferHeight), IPL_DEPTH_8U, 4);
videoFrame->imageData = (char*)bufferBaseAddress;
int channels = videoFrame->nChannels;
int widthStep = videoFrame->widthStep;
int width = videoFrame->width;
int height = videoFrame->height;
for(int i=0;i<height;i++){
uchar *col = ((uchar *)(videoFrame->imageData + i*widthStep));
for(int j=0;j<width;j++){
double pRed = col[j*channels + 0];
double pGreen = col[j*channels + 1];
double pBlue = col[j*channels + 2];
double dRed = green.val[0] - pRed;
double dGreen = green.val[1] - pGreen;
double dBlue = green.val[2] - pBlue;
double sDRed = dRed * …Run Code Online (Sandbox Code Playgroud) 如何将值放入图像数组?实际上由于bmpData.Stride,我无法在整个数组中执行此操作.存储值的字节大小应该在100左右,实际上是40.
我在使用时遇到了accessviolationexception System.Runtime.InteropServices.Marshal.Copy.
我在MSDN Library的代码示例中使用- Bitmap.LockBits方法(Rectangle,ImageLockMode,PixelFormat)
为什么我不能写那样的东西?
// Declare an array to hold the bytes of the bitmap.
int bytes = Math.Abs(bmpData.Width) * b.Height;
Run Code Online (Sandbox Code Playgroud)
我的整个代码是:
//Create new bitmap 10x10 = 100 pixels
Bitmap b = new Bitmap(10, 10, System.Drawing.Imaging.PixelFormat.Format1bppIndexed);
Rectangle rect = new Rectangle(0, 0, b.Width, b.Height);
System.Drawing.Imaging.BitmapData bmpData =
b.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
b.PixelFormat);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap. …Run Code Online (Sandbox Code Playgroud) 我有一个使用farmula 从RGB图像创建的灰度图像:
现在,我想尽可能将灰度图像转换回接近原始的RGB彩色图像.
我试过在互联网上找它,但找不到怎么做.维基百科建议它有可能但不解释如何.
0.3 * c.r + 0.59 * c.g + 0.11 * c.b
有人可以建议我该怎么做.
提前致谢.
image-processing ×10
opencv ×3
algorithm ×2
c ×2
c# ×2
matlab ×2
android ×1
c++ ×1
core-image ×1
delphi ×1
delphi-xe ×1
ios ×1
iphone ×1
marshalling ×1
matrix ×1