alexv0iceh / AutoChar

Stable Diffusion WebUI extension for fast and easy automatic creation of detailed character art.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenCV Errors

mageofthesands opened this issue · comments

The same issue with 0.8 is happening with 0.9.
error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'

100%|█████████████████████████████████████████████████| 21/21 [00:28<00:00, 1.38s/it] *** Error completing request██████████████████████████| 21/21 [00:24<00:00, 1.20s/it] *** Arguments: ('task(5i1q5l16dalwzaw)', 0, 'a woman,, (Photographic :1.3), Realistic, highly detailed, photographic, at Nighttime, (caustics:1.3), (medium close-up shot:1.3), (shot on 35mm film:1.3), (35mm lens:1.3), vanilla skin, quarter turn,1/4 body pose, head shot, averted gaze, wedge cut hair, sultry lips, bobby pin, sagging breasts, petite breasts, striped maxi dress with side slits, traditional tea house with paper lanterns, (seductive, alluring, charming:1.3), (highly detailed, high quality:1.3)', 'ZphyrInsanity_Negative, clone, cloned, bad anatomy, wrong anatomy, mutated hands and fingers, mutation, mutated, amputation, 3d render, lowres, signs, memes, labels, text, error, mutant, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, made by children, caricature, ugly, boring, sketch, lacklustre, repetitive, cropped, (long neck), body horror, out of frame, mutilated, tiled, frame, border, porcelain skin, doll like, doll, (deformed iris:1.2)', [], <PIL.Image.Image image mode=RGBA size=768x512 at 0x178A15F19F0>, None, None, None, None, None, None, 40, 'DPM++ 2M Karras', 4, 0, 1, 1, 1, 7, 1.5, 0.4, 0, 512, 768, 1, 0, 0, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x00000178A530E320>, 1, False, '', 0.8, -1, False, -1, 0, 0, 0, True, False, True, False, False, True, False, False, 'keyword prompt', 'keyword1, keyword2', 'None', 'textual inversion first', 'None', '0.7', 'None', False, 7, 100, 'Constant', 0, 'Constant', 0, 4, True, 'MEAN', 'AD', 1, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000178A530DF90>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000178A1519F00>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000178A151BD60>, True, 0.3, 'ESRGAN_4x', 0.5, 0.3, 0.2, 0.15, ['Automatic face inpaint', 'Automatic eyes inpaint'], False, 1.5, 1.25, False, True, True, 9, 64, False, 0.35, '* CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '

Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8

', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '

Will upscale the image by the selected scale factor; use width and height sliders to set tile size

', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False, 'General', True, False, '', '', '', '', '', 'Reset ALL General', 'Not set', 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1.3, 'Not set', 1, 'Not set', 'Not set', 1.3, 1.3, 'Not set', False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, 'Not set', 'Disabled', 1.3, 'Not set', 'Not set', 1.3, 'Not set', 'Disabled', 1, 'Not set', 1.3, 'Not set', 'Not set', 1, 1.3, 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 'Disabled', 'Not set', 1.3, 1.3, 1.3, 1.3, 'Not set', 'Not set', 1, True, True, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 'Not set', 'Disabled', 1, 1, 1, 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1.3, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 'Disabled', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 'Not set', 'Disabled', 1, 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 'Disabled', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 1, '', '', '

Loops: The number of times the script will inference your image and increase the resolution in increments. The amount the resolution is increased each loop is determined by this number and the maximum image width/height. The more loops, the more chances of your image picking up more detail, but also artifacts. 4 to 10 is what I find to work best, but you may like more or less.

Denoise change: This setting will increase or decrease the denoising strength every loop. A higher value will increase the denoising strength, while a lower value will decrease it. A setting of 1 keeps the denoising strength as it is set on the img2img settings.

Dimension change: This setting changes the amount of resolution increase or decrease per loop, keeping the changes from being linear. You will get non-linear increases in image size based on which easing option you choose. To increase the image size earlier in the process, choose one of the 'Ease Out' options, to increase the image size later in the process, choose an 'Ease In' option, to place image increases more toward the center of the process, use an 'Ease InOut' option.

Maximum Image Width/Height: These parameters set the maximum width and height of the final image. Always start with an image smaller than these dimensions. The smaller you start, the more impressive the results. I usually start at either 340x512 or 512x768

Detail, Blur, Smooth, Contour: These parameters are checkboxes that apply a PIL Image Filter to the final image.

Sharpness, Brightness, Color, Contrast: These parameters are sliders that adjust the sharpness, brightness, color, and contrast of the image. 1 will result in no adjustments, less than one reduces these settings for the final image and greater than 1 increases these settings.

Img2Img Settings: I recommend creating an image with txt2img and then sending the result to img2img with the prompt and settings. For this script I use these settings..

Resize mode - Crop and resize
Sampling method - DDIM
Sampling steps - 30
Width/Height - 340x512 or 512x768. I’d try to keep to the aspect ratio of the original image but these can be set lower than the resolution of the original image
CFG Scale - 6 to 8
Denoising strength - 0.2 to 0.4 is usual. The lower you go, the less change between loops. The higher you go the less the end result will look like the original image.
Seed - This doesn’t matter too much, I usually keep it at -1

', 4, 1, 1024, 1024, 1, False, 'None', 'None', False, 'None', 1, 1, 1, 1, 'Linear', None, None, False, None, None, False, None, None, False, 50, '

Will upscale the image depending on the selected target size type

', 512, 0, 16, 32, 64, 0.35, 32, 18, True, 0, False, 8, 0, 2, 2048, 2048, 1.5) {}
Traceback (most recent call last):
File "H:\stable-diffusion-webui-directml\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "H:\stable-diffusion-webui-directml\modules\call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "H:\stable-diffusion-webui-directml\modules\img2img.py", line 215, in img2img
processed = modules.scripts.scripts_img2img.run(p, *args)
File "H:\stable-diffusion-webui-directml\modules\scripts.py", line 601, in run
processed = script.run(p, *script_args)
File "H:\stable-diffusion-webui-directml\scripts\AutoChar_v09.py", line 613, in run
hr_fix_output.images[0] = enhance_image(hr_fix_output, strength)
File "H:\stable-diffusion-webui-directml\scripts\AutoChar_v09.py", line 220, in enhance_image
blended = cv2.addWeighted(dst, 0.6, dst2, 0.4, 0)
cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'


`

commented

The error you're seeing occurs because two images you're trying to combine using OpenCV don't have the same size or number of colors. To fix it, ensure both pictures have the same dimensions and colors before using them together in your code. Check how you're loading or creating these images to make sure they match in size and color format.