crop

Extract Characters using convex Hull coordinates - opencv - python

丶灬走出姿态 提交于 2019-12-08 19:39:28
问题 I have character images like this: Using following code I could get contours and convex hull, then I could draw convex for each character. import cv2 img = cv2.imread('test.png', -1) ret, threshed_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY) image, contours, hier = cv2.findContours(threshed_img, cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE) for cnt in contours: # get convex hull hull = cv2.convexHull(cnt) cv2.drawContours(img, [hull], -1, (0, 0, 255), 1)

CodeIgniter crop() without maintain_ration

天大地大妈咪最大 提交于 2019-12-08 13:23:46
问题 I have this function above witch even maintain_ration set false, cutting with this proportion. In this case the result is an image with 150x113px, because the original image has 400x300. function do_crop() { $config = array( 'image_library' => 'gd2', 'source_image' => realpath(APPPATH . '../upload_img/solg6.jpg'), 'new_image' => $this->gallery_path_url . 'thumbaaa.jpg', 'maintain_ration' => false, 'width' => 150, 'height' => 150, 'x_axis' => 20, 'y_axis' => 20 ); $this->load->library('image

Crop Image Located in Internal Storage

冷暖自知 提交于 2019-12-08 12:30:57
问题 I am having trouble using the crop intent in Android. I am storing images in the internal storage allocation for my app and I want to be able to crop them and then set them as the wallpaper. I can get it to work with an image stored in external storage and using this code: cropIntent.setDataAndType(Uri.fromFile(new File(uri)), "image/*"); When I execute the code below the intent fails to launch the crop intent and a 0 result code is returned. Intent cropIntent = new Intent("com.android.camera

OutOfMemoryError-Android Image Crop Issue

老子叫甜甜 提交于 2019-12-08 11:56:19
问题 I am using a cropper tool i found on GitHub. When I implement it on a separate module, it works absolutely fine.But, When I use the same code with in my actual application, I see "OutOfMemoryError".Below is the code snippet. I have been spending a lot of time on this and any help would be highly appreciated. Scan Activity: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { Uri imageUri = getPickImageResultUri(data)

CSS clip property - is there an alternative for cropping images?

淺唱寂寞╮ 提交于 2019-12-08 08:39:01
问题 I have an image gallery and I want the thumbnails to be cropped at 150px x 150px. The images aren't square - they are rectangular and all different sizes, so I can't set the width and height to 150px because the images will be all squashed and distorted. I'm wondering what other methods there are to do cropping for thumbnails apart from the CSS clip property. Are there any other CSS solutions or perhaps jQuery scripts? 回答1: You can use negative margins to achieve this. DEMO <p class="crop">

Select and crop with a maximum size in android

雨燕双飞 提交于 2019-12-08 08:30:41
问题 What I want to do it's to show the crop box, but with a maximum size. Something like that: Intent intent = new Intent(); intent.setType("image/*"); intent.putExtra("crop", "true"); intent.putExtra("max-width", 30); intent.putExtra("max-height", 30); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), IMAGE_SELECTED); 回答1: Try this: // Photo intent. Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType("image

let user crop image in iOS

隐身守侯 提交于 2019-12-08 07:31:18
问题 Is there a built in function in objective-c to do image cropping like the one in iOS photo gallery? I have tried enabling editing in UIImagePickerController, but it doesn't do the same. Thanks! 回答1: there are quite a few ways to crop images using the Core Graphics functions, the most basic one would be: CGRect cropRect = CGRectMake(0, 0, 100, 100); CGImageRef cropped_img = CGImageCreateWithImageInRect(yourUIImage.CGImage, cropRect) 回答2: This is no built in function. The way to do it would be

crop and align inserted BMP in Delphi

狂风中的少年 提交于 2019-12-08 07:14:53
问题 I want to crop and align the inserted BMP from the clipboard. I'm trying for 2 days but still nothing workable... procedure TForm1.act1Execute(Sender: TObject); var BMP : TBitmap; begin BMP := TBitmap.Create; BMP.Assign(Clipboard); BMP.SetSize(400,200); Img1.picture.Graphic := BMP; BMP.Free; end; procedure TForm1.act1Update(Sender: TObject); begin (Sender as TAction).Enabled := Clipboard.HasFormat(CF_BITMAP); end; end. 回答1: If I understand you right, you need to center the bitmap in the Image

Using “com.android.camera.action.CROP” Intent to crop images, returns small size bitmaps on some devices

不想你离开。 提交于 2019-12-08 07:07:12
问题 I am using "com.android.camera.action.CROP" to crop images from user`s image gallery.. Crop function: private void performCrop(String picUri) { try { Intent cropIntent = new Intent("com.android.camera.action.CROP"); File f = new File(picUri); Uri contentUri = Uri.fromFile(f); cropIntent.setDataAndType(contentUri, "image/*"); cropIntent.putExtra("crop", "false"); cropIntent.putExtra("aspectX", 1); cropIntent.putExtra("aspectY", 1); cropIntent.putExtra("outputX", 1024); //512 cropIntent

Resize viewport, crop scene

别等时光非礼了梦想. 提交于 2019-12-08 06:05:25
问题 I have a 3d scene drawn by OpenGL to a resizeable window. Now, when the window gets resized, I do not want to scale the viewport, rather I want to keep the scene at a fixed size and show a larger portion of it (or crop the scene image). This is my current code: GLfloat ratio; // Protect against a divide by zero if ( height == 0 ) height = 1; ratio = ( GLfloat )width / ( GLfloat )height; // Setup our viewport. glViewport( 0, 0, ( GLint )width, ( GLint )height ); // change to the projection