Comments (8)
Embarrassingly, I couldn't reproduce those bugs, which may be caused by something else instead of this new feature. 🤣
And yes, it is very convenient to use PIL or OpenCV to implement various pre-processing, which is exactly what I am doing.
Thank you for all your help! 🍻
from carefree-drawboard.
btw, before that, if you want to try the fusing algorithm anyway, you can try these settings:
class Fusing(IFieldsPlugin): @property def settings(self) -> IPluginSettings: return IPluginSettings( ..., pluginInfo=IFieldsPluginInfo( definitions=dict( url0=IImageField(label="Image 0"), url1=IImageField(label="Image 1"), # Your original definitions, leave it blank if there weren't any! ... ), ), ) async def process(self, data: ISocketRequest) -> List[Image.Image]: img_url0 = data.extraData["url0"] img_url1 = data.extraData["url1"] img0 = await self.load_image(img_url0) img1 = await self.load_image(img_url1) ... return img_fused class ImagesFollowers(IPluginGroup): @property def settings(self) -> IPluginSettings: return IPluginSettings( ..., # this modified line means the plugin will always be displayed nodeConstraintRules=None, ..., pluginInfo=IPluginGroupInfo( ... plugins={ "fusing": Fusing, }, ), )By using
IImageField
, you should be able to see the nice 'image picker's in the plugin, where you can pick up the images on the drawboard, and the selected ones will be placed at first!
Very useful feature! Thanks for these tips! 🤩
from carefree-drawboard.
Ah, this is a good feature that is currently lack of, I'll develop it today and let you know once it is done!
Here's my plan: you can specify an argument in
IPluginSettings
, with which I'll return the full images to you. Currently, I'll use the largest image as a 'canvas' and 'crop' those images, which is useful for outpainting features.
And in case you don't know: I implemented an internal method for all plugins to download images, so maybe you can try:
class Fusing(IFieldsPlugin):
...
img0 = await self.load_image(img_url0)
img1 = await self.load_image(img_url1)
To simplify your implementations!
from carefree-drawboard.
btw, before that, if you want to try the fusing algorithm anyway, you can try these settings:
class Fusing(IFieldsPlugin):
@property
def settings(self) -> IPluginSettings:
return IPluginSettings(
...,
pluginInfo=IFieldsPluginInfo(
definitions=dict(
url0=IImageField(label="Image 0"),
url1=IImageField(label="Image 1"),
# Your original definitions, leave it blank if there weren't any!
...
),
),
)
async def process(self, data: ISocketRequest) -> List[Image.Image]:
img_url0 = data.extraData["url0"]
img_url1 = data.extraData["url1"]
img0 = await self.load_image(img_url0)
img1 = await self.load_image(img_url1)
...
return img_fused
class ImagesFollowers(IPluginGroup):
@property
def settings(self) -> IPluginSettings:
return IPluginSettings(
...,
# this modified line means the plugin will always be displayed
nodeConstraintRules=None,
...,
pluginInfo=IPluginGroupInfo(
...
plugins={
"fusing": Fusing,
},
),
)
By using IImageField
, you should be able to see the nice 'image picker's in the plugin, where you can pick up the images on the drawboard, and the selected ones will be placed at first!
from carefree-drawboard.
I've pushed some codes and now you can do something like this after installing the latest codes with pip install -e .
:
class Fusing(IFieldsPlugin):
@property
def settings(self) -> IPluginSettings:
return IPluginSettings(
...,
pluginInfo=IFieldsPluginInfo(
# add this line!
exportFullImages=True,
...
),
)
...
By specifying exportFullImages=True
, the images will be exported as-is!
However some cutting edge features are being pushed as well so it might be buggy 🤣
from carefree-drawboard.
For exportFullImages=True
, I found that it seems to return only two raw images (without the user's transformation on the UI), and no intersection between these two.
But anyway, I'm surprised that you directly helped me develop this feature, so thank you very much. 😉 👍
from carefree-drawboard.
I just found that the returned <SingleNodeType.IMAGE> provides quite a lot of properties, which can be used to customize the various operations I need.
Maybe, we don't need to add this new feature
exportFullImages=True
, in order to avoid a series of bugs 😨 (e.g. in drawing masks for inpainting)
from carefree-drawboard.
Ah! You discovered something I missed: I've put the original (raw) image url in the meta -> data -> url
field!
But this is not something very stable... So I'll keep the exportFullImages
feature if only somebody needs it. 😉
You've mentioned 'a series of bugs', theoretically everything should be the same when
exportFullImages=False
, but yes, ifexportFullImages=True
& you try to send masks / blank nodes, it might be buggy. What situation are you in?
And, you've mentioned you want the user's transformation on the UI - this has a stable solution: there's a transform
property in the nodeData
, with which you can use cv2
to transform the image if you need!
And for the intersection - theoretically, you can create a large canvas, transform & paste the images to the canvas with their transform
s, then crop the area you need. It is a little complicated though. 😵💫
from carefree-drawboard.
Related Issues (4)
- blank page HOT 4
- Setup is missing package "regex" HOT 1
- Unable to install frontend packages HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carefree-drawboard.