Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 16:26
    kmuehlbauer commented #1568
  • Jan 31 2019 16:15
    kmuehlbauer commented #1568
  • Jan 31 2019 15:53
    djhoese commented #1568
  • Jan 31 2019 15:46
    kmuehlbauer edited #1568
  • Jan 31 2019 15:44
    kmuehlbauer opened #1568
  • Jan 31 2019 15:32
    djhoese commented #1566
  • Jan 31 2019 15:30
    djhoese commented #1567
  • Jan 31 2019 14:18
    GuillaumeFavelier commented #1561
  • Jan 31 2019 14:15
    GuillaumeFavelier commented #1561
  • Jan 31 2019 12:46
    opekar synchronize #1130
  • Jan 31 2019 09:54
    kmuehlbauer commented #1567
  • Jan 31 2019 09:53
    kmuehlbauer synchronize #1567
  • Jan 31 2019 09:37
    kmuehlbauer labeled #1567
  • Jan 31 2019 09:37
    kmuehlbauer labeled #1567
  • Jan 31 2019 09:37
    kmuehlbauer labeled #1563
  • Jan 31 2019 09:36
    kmuehlbauer labeled #1563
  • Jan 31 2019 09:28
    kmuehlbauer commented #1567
  • Jan 31 2019 09:27
    kmuehlbauer synchronize #1567
  • Jan 31 2019 09:19
    kmuehlbauer assigned #1563
  • Jan 31 2019 09:17
    kmuehlbauer opened #1567
Lorenzo Gaifas
@brisvag
image.png
Hi @kresdjan, I'm not familiar with emacs, so I might say somethign stupid, but I use vim and completion works just fine. Are you sure you're working in the correct environment? Vispy + language server works fine for me:
As far as I can tell, you should be good to go with pyright, especially fi you know it works with numpy
I use pylsp though
christian
@kresdjan
@brisvag "Are you sure you're working in the correct environment?" I would like to thing so, let me triple check, it wouldn't be the first time I've done something silly.
christian
@kresdjan

Maybe I should try pylsp or another option. I can get autocompletion for vispy up until a module, it seems like my language-server is not capable of recursively digging into the modules.

from vispy.scene.visuals import i get auto-completetion on vispy then scene then visuals, then it stops it has no idea about waht it inside visuals. But numpy has. It just keeps digging.

There is documentation for anything with vispy, it doesn't what scene or visuals are, it is just generic (module) scene or when I try to access scene in code scene: Unknown . But numpy spits out information for as long as you go :D

vispy 3.png
vispy 2.png
vispy 1.png
numpy 1.png
numpy 2.png
christian
@kresdjan
It is a pyright issue. I removed it and install the jedi-language-server and know I get what I expect. Sorry.
Skærmbillede 2022-11-29 kl. 13.07.17.png
Skærmbillede 2022-11-29 kl. 13.07.33.png
Lorenzo Gaifas
@brisvag
Nice, good that you fixed it! I wonder what the actual issue was though. I did try pyright in the past and then ditched it because it was not doing everything I wanted, but I don't remember the details... maybe it's still limited :P
christian
@kresdjan
This is my first experience with it, I picked solely perhaps it had the most stars on GitHub and being developed my Microsoft, who invented the LSP protocol I thought it would be the best options. It is properly so VSCodie that it doesn't work so well outside of it. Or I haven't installed it correctly. I used homebrew for that.
Thomas Doman
@tjjdoman_gitlab
Hello can some one help confirm that changing the color map of a visual should not require a recompilation of the shader code? I have found the comment https://github.com/vispy/vispy/blob/main/vispy/color/colormap.py#L284 that says that it is passed to the shader as a texture which makes me think recompilation is not required as changing the data of an image visual passes in a new texture and doesnt need a shader recompilation (I think). Any help would be greatly appreciated!
David Hoese
@djhoese
@tjjdoman_gitlab It is ultimately up to the Visual how it handles new colormaps, but colormaps are also not all the same shader. Some have custom shader code to do more complex color mapping. There could be optimizations added to visuals like the ImageVisual to only update the texture if the colormap shader stays the same, but those optimizations do not currently exist from what I can tell.
joshhewitt
@joshhewitt
Hello. does anyone have experience with grayscale images? I have a problem adding a colored line to a grayscale image and displaying it correctly. i open a stackoverflow issue: https://stackoverflow.com/questions/74714538/how-to-add-colored-lines-with-opencv-after-covnersion-from-grayscale-to-color-v
Lorenzo Gaifas
@brisvag
At a first glance, I see this line:
cmap='grays'
this is setting the colormap of your image to grayscale.
joshhewitt
@joshhewitt
@brisvag yes. I played around with that. but then if I use other parameters for cmap (there are a ton of them). it colors the images completely. i dont want this. i want the image to stay with its natural colors
Lorenzo Gaifas
@brisvag
You probably want to remove it and/or change it to a different colormap? I'm not sure I follow what your goal is
The image is RGB? Sorry if I'm missing something, I only looked at the code superficially :P
joshhewitt
@joshhewitt
@brisvag the goal is : i have a grayscale image. and i need to add a colored line to it. the original shape is (x,y) but to add a colored pixels i convert it with cv2 to (x,y,3) . when i add the line and try to display it i don t get the image i want
Lorenzo Gaifas
@brisvag
But the image itself is grayscale?
Did you consider using a Line visual from vispy, or do you actually want the numpy array with the image data to be changed?
joshhewitt
@joshhewitt
@brisvag yes the image itself is grayscale with 2d array shape . if i do this without vispy. only cv2. i get the colored line in the image wihtout any problems. Line is a bit more complicated because the image will move in the canvas and i need to add the line at exact pixels in the displayed image.
Lorenzo Gaifas
@brisvag
You can move the line too :P But if you prefer to change the image data, that's possible. Are you sure the conversion to RGB is doing what you meant? If you want to keep the rest grayscale, you need to set R, G and B all equal to the original value
joshhewitt
@joshhewitt
@brisvag I want to keep the rest grayscale yes. do you have any tip on how to do that ? (PS: i am not sure that the conversion to RGB is doing what I want , I was experementing.... because my original image is only a 2d array )
Lorenzo Gaifas
@brisvag
Ok :) so if your original image has shape (n, m), you want your rgb to be (n, m, 3) (or 4 if you care about transparency). The 3 value on each i,j pixel represent the RGB values. To get grays, you need the same amount of R, G, and B. So in your case, you could do:
import numpy as np
grayscale = np.random.rand(10, 5)
rbg = np.stack([grayscale, grayscale, grayscale], axis=-1)
rgb*
then simply leave out the cmap= line and I think it should work.
joshhewitt
@joshhewitt
@brisvag i see your point. but still does not work. the cmap is problematic. if oyu leave it out then the picture is colored with weird colors (corresponding to whatever cmap is used as standard) all i want is to get exactly my image with the added colored line
Lorenzo Gaifas
@brisvag
It shouldn't use any "colormap" if the image is RGB. Maybe take a look at the image example on the vispy repo and see if you can spot something else you did differently?
you can ignore all the code about the interpolation modes; the core of it is:
img_data = read_png(load_data_file('mona_lisa/mona_lisa_sm.png'))  # an (n, m, 3) array

image = scene.visuals.Image(img_data, interpolation='nearest',
                            parent=view.scene, method='subdivide')
you can even leave out the method
joshhewitt
@joshhewitt
@brisvag i can t see anything different from the code. they just included a directly colored image. the weird problem i have is when adding the line and saving it in my local repo i can see the correct image with the correct colors (i.e. the conversion + adding the colored line functioned correctly). the problem is purely when showing it with vispy.
Lorenzo Gaifas
@brisvag
sanity check: what if you take the code from the example above, and simply replace the image with your image data?
Oh wait, one thing: are you still initializing the image the same way (using a 1x1x1 array)?
joshhewitt
@joshhewitt
@brisvag i did exactly that thinking maybe there was a problem with imageio .... but same problem at the end...
Lorenzo Gaifas
@brisvag
You might have to initialize it with a valid rgb array
so just pass a (1, 1, 3)
joshhewitt
@joshhewitt
@brisvag YES!!!!!!!!!!!!! the problem was with the initializazion. i can t thank you enough for helping me!
Lorenzo Gaifas
@brisvag
aha! glad we caught it :) Maybe there's a way to update the initialization posthumously, but I doubt it
so the image visual was stuck in grayscale land :P
and it was treating the image as a (n, m, 1) I suppose, and just ignoring the last 2 dims
joshhewitt
@joshhewitt
@brisvag interesting how one little parameter at the initialization could change everything i was stuck at this for hours. thank you again for your valuable help
Lorenzo Gaifas
@brisvag
Yeah, sometimes these things are not as smooth as we'd hope! You're welcome :)