iphone Programming Glossary: scalefactor
adjust corners and crop the image openCV http://stackoverflow.com/questions/13098073/adjust-corners-and-crop-the-image-opencv is taken into account cv Point2f imageVertices 4 float distanceP1P2 float distanceP1P3 BOOL isLandscape true int scaleFactor cv Mat paperImage cv Mat paperImageCorrected cv Point2f paperVertices 4 sort square corners for further operations square.. imageVertices 0 imageVertices 2 calc paper paperVertices take orientation into account if distanceP1P2 distanceP1P3 scaleFactor ceil lroundf distanceP1P2 paperHeight we always want to scale the image down to maintain the best quality possible paperImage.. paperHeight we always want to scale the image down to maintain the best quality possible paperImage cv Mat paperWidth scaleFactor paperHeight scaleFactor CV_8UC3 paperVertices 0 cv Point 0 0 paperVertices 1 cv Point paperHeight scaleFactor 0 paperVertices..
UIImage rounded corners http://stackoverflow.com/questions/262156/uiimage-rounded-corners CGSize targetSize CGSize imageSize self size float width imageSize.width float height imageSize.height scaleFactor will be the fraction that we'll use to adjust the size. For example if we shrink an image by half scaleFactor will be 0.5... scaleFactor will be the fraction that we'll use to adjust the size. For example if we shrink an image by half scaleFactor will be 0.5. the scaledWidth and scaledHeight will be the original multiplied by the scaleFactor. IMPORTANT the targetHeight.. an image by half scaleFactor will be 0.5. the scaledWidth and scaledHeight will be the original multiplied by the scaleFactor. IMPORTANT the targetHeight is the size of the space we're drawing into. The scaledHeight is the height that the image..
UIImage: Resize, then Crop http://stackoverflow.com/questions/603907/uiimage-resize-then-crop CGFloat height imageSize.height CGFloat targetWidth targetSize.width CGFloat targetHeight targetSize.height CGFloat scaleFactor 0.0 CGFloat scaledWidth targetWidth CGFloat scaledHeight targetHeight CGPoint thumbnailPoint CGPointMake 0.0 0.0 if CGSizeEqualToSize.. NO CGFloat widthFactor targetWidth width CGFloat heightFactor targetHeight height if widthFactor heightFactor scaleFactor widthFactor scale to fit height else scaleFactor heightFactor scale to fit width scaledWidth width scaleFactor scaledHeight.. heightFactor targetHeight height if widthFactor heightFactor scaleFactor widthFactor scale to fit height else scaleFactor heightFactor scale to fit width scaledWidth width scaleFactor scaledHeight height scaleFactor center the image if widthFactor..
Resize UIImage by keeping Aspect ratio and width http://stackoverflow.com/questions/7645454/resize-uiimage-by-keeping-aspect-ratio-and-width UIImage imageWithImage UIImage sourceImage scaledToWidth float i_width float oldWidth sourceImage.size.width float scaleFactor i_width oldWidth float newHeight sourceImage.size.height scaleFactor float newWidth oldWidth scaleFactor UIGraphicsBeginImageContext.. float oldWidth sourceImage.size.width float scaleFactor i_width oldWidth float newHeight sourceImage.size.height scaleFactor float newWidth oldWidth scaleFactor UIGraphicsBeginImageContext CGSizeMake newWidth newHeight sourceImage drawInRect CGRectMake.. float scaleFactor i_width oldWidth float newHeight sourceImage.size.height scaleFactor float newWidth oldWidth scaleFactor UIGraphicsBeginImageContext CGSizeMake newWidth newHeight sourceImage drawInRect CGRectMake 0 0 newWidth newHeight UIImage..
|