mirror of
https://github.com/helblazer811/ManimML.git
synced 2025-08-06 17:29:45 +08:00
Finished oracle guidance video. Integrated various changes necessary to complete this.
This commit is contained in:
@ -2,6 +2,8 @@ from manim import *
|
||||
from manim_ml.image import GrayscaleImageMobject
|
||||
from manim_ml.neural_network.layers.parent_layers import NeuralNetworkLayer
|
||||
|
||||
from PIL import Image
|
||||
|
||||
class ImageLayer(NeuralNetworkLayer):
|
||||
"""Single Image Layer for Neural Network"""
|
||||
|
||||
@ -17,6 +19,17 @@ class ImageLayer(NeuralNetworkLayer):
|
||||
self.image_mobject = ImageMobject(self.numpy_image).scale_to_fit_height(height)
|
||||
self.add(self.image_mobject)
|
||||
|
||||
@classmethod
|
||||
def from_path(cls, image_path, grayscale=True, **kwargs):
|
||||
"""Creates a query using the paths"""
|
||||
# Load images from path
|
||||
image = Image.open(image_path)
|
||||
numpy_image = np.asarray(image)
|
||||
# Make the layer
|
||||
image_layer = cls(numpy_image, **kwargs)
|
||||
|
||||
return image_layer
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_override(self, **kwargs):
|
||||
debug_mode = False
|
||||
|
Reference in New Issue
Block a user